blob: b94d2751f8ffc7db0737a36476786e42c9d3ebd6 [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
Norman Jamese2765102015-08-19 22:00:55 -05009
10%.o: interfaces/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040011 $(CC) -c -fPIC -o obj/$@ $< $(CFLAGS) $(INCLUDES)
Norman Jamese2765102015-08-19 22:00:55 -050012
13%.o: objects/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040014 $(CC) -c -o obj/$@ $< $(LIBS) $(CFLAGS) $(INCLUDES)
Norman Jamesddb97382015-08-27 21:31:31 -050015
16%.o: includes/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040017 $(CC) -c -o obj/$@ $< $(LIBS) $(CFLAGS) $(INCLUDES)
Norman Jamese2765102015-08-19 22:00:55 -050018
19%.o: objects/pflash/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040020 $(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
Norman Jamese2765102015-08-19 22:00:55 -050021
Norman Jamesf066e872015-10-07 15:29:51 -050022%.o: objects/pflash/libflash/%.c
Brad Bishop831188f2015-10-19 14:10:12 -040023 $(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
Norman James1e25d1d2015-09-15 08:20:56 -050024
Norman James8dd49932016-01-30 15:10:46 -060025all: 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
Adriana Kobylak597d49e2015-10-29 08:33:03 -050026
Norman Jamesf066e872015-10-07 15:29:51 -050027setup:
Adriana Kobylak597d49e2015-10-29 08:33:03 -050028 mkdir -p obj lib
Norman James1e25d1d2015-09-15 08:20:56 -050029
Norman James5e792e32015-10-07 17:36:17 -050030clean:
Adriana Kobylak597d49e2015-10-29 08:33:03 -050031 rm -rf obj lib bin/*.exe
Norman James5e792e32015-10-07 17:36:17 -050032
Norman James362a80f2015-09-14 14:04:39 -050033libopenbmc_intf: openbmc_intf.o
Adriana Kobylak597d49e2015-10-29 08:33:03 -050034 $(CC) -shared -o lib/$@.so obj/openbmc_intf.o $(LDFLAGS)
Norman Jamese2765102015-08-19 22:00:55 -050035
Norman James37478222015-10-31 17:26:01 -050036power_control: power_control_obj.o gpio.o object_mapper.o libopenbmc_intf
37 $(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050038
Norman James37478222015-10-31 17:26:01 -050039led_controller: led_controller.o gpio.o object_mapper.o libopenbmc_intf
40 $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050041
vishwa7154ed92016-01-22 06:01:35 -060042led_controller_new: led_controller_new.o
43 $(CC) -o bin/$@.exe obj/led_controller_new.o $(LDFLAGS) $(LIBS) -lsystemd
44
Norman James37478222015-10-31 17:26:01 -050045button_power: button_power_obj.o gpio.o object_mapper.o libopenbmc_intf
46 $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050047
Kenc95eccd2015-12-19 07:02:34 +080048button_reset: button_reset_obj.o gpio.o object_mapper.o libopenbmc_intf
49 $(CC) -o bin/$@.exe obj/button_reset_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
50
51
Norman James37478222015-10-31 17:26:01 -050052control_host: control_host_obj.o gpio.o object_mapper.o libopenbmc_intf
53 $(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050054
Norman James37478222015-10-31 17:26:01 -050055flash_bios: flash_bios_obj.o object_mapper.o libopenbmc_intf
56 $(CC) -o bin/$@.exe obj/flash_bios_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050057
Norman James37478222015-10-31 17:26:01 -050058host_watchdog: host_watchdog_obj.o object_mapper.o libopenbmc_intf
59 $(CC) -o bin/$@.exe obj/host_watchdog_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman James471ab592015-08-30 22:29:40 -050060
Brad Bishop831188f2015-10-19 14:10:12 -040061board_vpd: board_vpd_obj.o libopenbmc_intf
62 $(CC) -o bin/$@.exe obj/board_vpd_obj.o $(LDFLAGS) $(LIBS)
Norman James1e25d1d2015-09-15 08:20:56 -050063
Brad Bishop831188f2015-10-19 14:10:12 -040064pcie_slot_present: pcie_slot_present_obj.o gpio.o libopenbmc_intf
65 $(CC) -o bin/$@.exe obj/pcie_slot_present_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
Norman James19e45912015-10-04 20:19:41 -050066
Brad Bishop831188f2015-10-19 14:10:12 -040067flasher: $(OBJS2) flasher_obj.o libopenbmc_intf
68 $(CC) -o bin/$@.exe obj/flasher_obj.o $(OBJS3) $(LDFLAGS) $(LIBS)
Norman James1e25d1d2015-09-15 08:20:56 -050069
Norman James37478222015-10-31 17:26:01 -050070pflash: $(OBJS2) pflash.o
71 $(CC) -o bin/$@ obj/pflash.o $(OBJS3) $(LDFLAGS)
Norman James18998182015-10-11 21:54:53 -050072
Norman Jamesb2acbc82015-11-06 02:23:04 -060073hwmons_barreleye: hwmons_barreleye.o object_mapper.o libopenbmc_intf
74 $(CC) -o bin/$@.exe obj/hwmons_barreleye.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
Norman James5236a8f2015-11-05 20:39:31 -060075