blob: 7129082d75c32af7c8b120d965b8d12a376251d9 [file] [log] [blame]
Norman James88872672015-09-21 16:51:35 -05001#CC=gcc
Norman Jamese2765102015-08-19 22:00:55 -05002OBJS = objects/pflash/progress.o objects/pflash/ast-sf-ctrl.o
3OBJS += objects/pflash/libflash/libflash.o objects/pflash/libflash/libffs.o
4OBJS += objects/pflash/arm_io.o
Norman Jamesf066e872015-10-07 15:29:51 -05005OBJS2 = progress.o ast-sf-ctrl.o libflash.o libffs.o arm_io.o
6OBJS3 = obj/progress.o obj/ast-sf-ctrl.o obj/libflash.o obj/libffs.o obj/arm_io.o
Brad Bishop831188f2015-10-19 14:10:12 -04007INCLUDES=$(shell pkg-config --cflags gio-unix-2.0 glib-2.0) -Iincludes -Iobjects/pflash -I.
Adriana Kobylak597d49e2015-10-29 08:33:03 -05008LIBS=$(shell pkg-config --libs gio-unix-2.0 glib-2.0) -Llib -lopenbmc_intf
Adriana Kobylakcc2be262016-02-09 16:50:14 -06009INCLUDES += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
10LIB_FLAG += $(shell pkg-config --libs libsystemd)
Norman Jamese2765102015-08-19 22:00:55 -050011
12%.o: interfaces/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040013 $(CC) -c -fPIC -o obj/$@ $< $(CFLAGS) $(INCLUDES)
Norman Jamese2765102015-08-19 22:00:55 -050014
15%.o: objects/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040016 $(CC) -c -o obj/$@ $< $(LIBS) $(CFLAGS) $(INCLUDES)
Norman Jamesddb97382015-08-27 21:31:31 -050017
18%.o: includes/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040019 $(CC) -c -o obj/$@ $< $(LIBS) $(CFLAGS) $(INCLUDES)
Norman Jamese2765102015-08-19 22:00:55 -050020
21%.o: objects/pflash/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040022 $(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
Norman Jamese2765102015-08-19 22:00:55 -050023
Norman Jamesf066e872015-10-07 15:29:51 -050024%.o: objects/pflash/libflash/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040025 $(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
Norman James1e25d1d2015-09-15 08:20:56 -050026
Norman James78b7cfb2016-01-31 23:29:36 -060027all: setup libopenbmc_intf power_control led_controller button_power button_reset control_host host_watchdog board_vpd pcie_slot_present flash_bios flasher pflash hwmons_barreleye control_bmc
Adriana Kobylak597d49e2015-10-29 08:33:03 -050028
Norman Jamesf066e872015-10-07 15:29:51 -050029setup:
Adriana Kobylak597d49e2015-10-29 08:33:03 -050030 mkdir -p obj lib
Norman James1e25d1d2015-09-15 08:20:56 -050031
Norman James5e792e32015-10-07 17:36:17 -050032clean:
Adriana Kobylak597d49e2015-10-29 08:33:03 -050033 rm -rf obj lib bin/*.exe
Norman James5e792e32015-10-07 17:36:17 -050034
Norman James362a80f2015-09-14 14:04:39 -050035libopenbmc_intf: openbmc_intf.o
Adriana Kobylak597d49e2015-10-29 08:33:03 -050036 $(CC) -shared -o lib/$@.so obj/openbmc_intf.o $(LDFLAGS)
Norman Jamese2765102015-08-19 22:00:55 -050037
Brad Bishop58e694d2016-04-13 16:04:32 -040038power_control: power_control_obj.o gpio.o libopenbmc_intf
39 $(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050040
Adriana Kobylak9c751042016-02-09 13:44:32 -060041led_controller: led_controller.o
Adriana Kobylakcc2be262016-02-09 16:50:14 -060042 $(CC) -o bin/$@.exe obj/led_controller.o $(LDFLAGS) $(LIB_FLAG)
vishwa7154ed92016-01-22 06:01:35 -060043
Brad Bishop58e694d2016-04-13 16:04:32 -040044button_power: button_power_obj.o gpio.o libopenbmc_intf
45 $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050046
Brad Bishop58e694d2016-04-13 16:04:32 -040047button_reset: button_reset_obj.o gpio.o libopenbmc_intf
48 $(CC) -o bin/$@.exe obj/button_reset_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
Kenc95eccd2015-12-19 07:02:34 +080049
50
Brad Bishop58e694d2016-04-13 16:04:32 -040051control_host: control_host_obj.o gpio.o libopenbmc_intf
52 $(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050053
Brad Bishop58e694d2016-04-13 16:04:32 -040054flash_bios: flash_bios_obj.o libopenbmc_intf
55 $(CC) -o bin/$@.exe obj/flash_bios_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050056
Brad Bishop58e694d2016-04-13 16:04:32 -040057host_watchdog: host_watchdog_obj.o libopenbmc_intf
58 $(CC) -o bin/$@.exe obj/host_watchdog_obj.o $(LDFLAGS) $(LIBS)
Norman James471ab592015-08-30 22:29:40 -050059
Brad Bishop831188f2015-10-19 14:10:12 -040060board_vpd: board_vpd_obj.o libopenbmc_intf
61 $(CC) -o bin/$@.exe obj/board_vpd_obj.o $(LDFLAGS) $(LIBS)
Norman James1e25d1d2015-09-15 08:20:56 -050062
Brad Bishop831188f2015-10-19 14:10:12 -040063pcie_slot_present: pcie_slot_present_obj.o gpio.o libopenbmc_intf
64 $(CC) -o bin/$@.exe obj/pcie_slot_present_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
Norman James19e45912015-10-04 20:19:41 -050065
Brad Bishop831188f2015-10-19 14:10:12 -040066flasher: $(OBJS2) flasher_obj.o libopenbmc_intf
67 $(CC) -o bin/$@.exe obj/flasher_obj.o $(OBJS3) $(LDFLAGS) $(LIBS)
Norman James1e25d1d2015-09-15 08:20:56 -050068
Norman James37478222015-10-31 17:26:01 -050069pflash: $(OBJS2) pflash.o
70 $(CC) -o bin/$@ obj/pflash.o $(OBJS3) $(LDFLAGS)
Norman James18998182015-10-11 21:54:53 -050071
Brad Bishop58e694d2016-04-13 16:04:32 -040072hwmons_barreleye: hwmons_barreleye.o libopenbmc_intf
73 $(CC) -o bin/$@.exe obj/hwmons_barreleye.o $(LDFLAGS) $(LIBS)
Norman James5236a8f2015-11-05 20:39:31 -060074
Norman James78b7cfb2016-01-31 23:29:36 -060075control_bmc: control_bmc_obj.o libopenbmc_intf
76 $(CC) -o bin/$@.exe obj/control_bmc_obj.o $(LDFLAGS) $(LIBS)
77