blob: b7f00531f5ccefa18648c8c9a9a1a04b721a9aa0 [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.
8LIBS=$(shell pkg-config --libs gio-unix-2.0 glib-2.0) -Lbin -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 Jamesf066e872015-10-07 15:29:51 -050025setup:
Brad Bishop831188f2015-10-19 14:10:12 -040026 mkdir -p obj
Norman James1e25d1d2015-09-15 08:20:56 -050027
Norman James5e792e32015-10-07 17:36:17 -050028clean:
29 rm -rf obj
30
Norman James362a80f2015-09-14 14:04:39 -050031libopenbmc_intf: openbmc_intf.o
Brad Bishop831188f2015-10-19 14:10:12 -040032 $(CC) -shared -o bin/$@.so obj/openbmc_intf.o $(LDFLAGS)
Norman Jamese2765102015-08-19 22:00:55 -050033
Brad Bishop831188f2015-10-19 14:10:12 -040034power_control: power_control_obj.o gpio.o libopenbmc_intf
35 $(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050036
Brad Bishop831188f2015-10-19 14:10:12 -040037led_controller: led_controller.o gpio.o libopenbmc_intf
38 $(CC) -o bin/$@.exe obj/gpio.o obj/led_controller.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050039
Brad Bishop831188f2015-10-19 14:10:12 -040040sensor_ambient: sensor_threshold.o sensor_temperature_ambient_obj.o libopenbmc_intf
41 $(CC) -o bin/$@.exe obj/sensor_threshold.o obj/sensor_temperature_ambient_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050042
Brad Bishop831188f2015-10-19 14:10:12 -040043button_power: button_power_obj.o gpio.o libopenbmc_intf
44 $(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050045
Brad Bishop831188f2015-10-19 14:10:12 -040046control_host: control_host_obj.o gpio.o libopenbmc_intf
47 $(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050048
Brad Bishop831188f2015-10-19 14:10:12 -040049flash_bios: flash_bios_obj.o libopenbmc_intf
50 $(CC) -o bin/$@.exe obj/flash_bios_obj.o $(LDFLAGS) $(LIBS)
Norman Jamese2765102015-08-19 22:00:55 -050051
Brad Bishop831188f2015-10-19 14:10:12 -040052fan: fan_generic_obj.o gpio.o libopenbmc_intf
53 $(CC) -o bin/$@.exe obj/gpio.o obj/fan_generic_obj.o $(LDFLAGS) $(LIBS)
Norman James471ab592015-08-30 22:29:40 -050054
Brad Bishop831188f2015-10-19 14:10:12 -040055host_watchdog: host_watchdog_obj.o libopenbmc_intf
56 $(CC) -o bin/$@.exe obj/host_watchdog_obj.o $(LDFLAGS) $(LIBS)
Norman James471ab592015-08-30 22:29:40 -050057
Brad Bishop831188f2015-10-19 14:10:12 -040058control_bmc: control_bmc_obj.o libopenbmc_intf
59 $(CC) -o bin/$@.exe obj/control_bmc_obj.o $(LDFLAGS) $(LIBS)
Norman James471ab592015-08-30 22:29:40 -050060
Brad Bishop831188f2015-10-19 14:10:12 -040061sensor_occ: sensor_occ_obj.o libopenbmc_intf
62 $(CC) -o bin/$@.exe obj/sensor_occ_obj.o $(LDFLAGS) $(LIBS)
Norman James471ab592015-08-30 22:29:40 -050063
Brad Bishop831188f2015-10-19 14:10:12 -040064board_vpd: board_vpd_obj.o libopenbmc_intf
65 $(CC) -o bin/$@.exe obj/board_vpd_obj.o $(LDFLAGS) $(LIBS)
Norman James1e25d1d2015-09-15 08:20:56 -050066
Brad Bishop831188f2015-10-19 14:10:12 -040067pcie_slot_present: pcie_slot_present_obj.o gpio.o libopenbmc_intf
68 $(CC) -o bin/$@.exe obj/pcie_slot_present_obj.o obj/gpio.o $(LDFLAGS) $(LIBS)
Norman James19e45912015-10-04 20:19:41 -050069
Brad Bishop831188f2015-10-19 14:10:12 -040070flasher: $(OBJS2) flasher_obj.o libopenbmc_intf
71 $(CC) -o bin/$@.exe obj/flasher_obj.o $(OBJS3) $(LDFLAGS) $(LIBS)
Norman James1e25d1d2015-09-15 08:20:56 -050072
Brad Bishop831188f2015-10-19 14:10:12 -040073hwmon: hwmon_intf.o libopenbmc_intf
74 $(CC) -o bin/$@.exe obj/hwmon_intf.o $(LDFLAGS) $(LIBS)
Norman James18998182015-10-11 21:54:53 -050075
Norman Jamesa3e47c42015-10-18 14:43:10 -050076
Brad Bishop831188f2015-10-19 14:10:12 -040077all: setup libopenbmc_intf power_control led_controller sensor_ambient button_power control_host fan host_watchdog control_bmc board_vpd pcie_slot_present flash_bios flasher