xref: /openbmc/skeleton/Makefile (revision cc2be2678bd762aa23485e2dd7b0634b6275e956)
1#CC=gcc
2OBJS    = 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
5OBJS2   = 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
7INCLUDES=$(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) -Llib -lopenbmc_intf
9INCLUDES += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
10LIB_FLAG += $(shell pkg-config  --libs libsystemd)
11
12%.o: interfaces/%.c
13	$(CC) -c -fPIC -o obj/$@ $< $(CFLAGS) $(INCLUDES)
14
15%.o: objects/%.c
16	$(CC) -c -o obj/$@ $< $(LIBS) $(CFLAGS) $(INCLUDES)
17
18%.o: includes/%.c
19	$(CC) -c -o obj/$@ $< $(LIBS) $(CFLAGS) $(INCLUDES)
20
21%.o: objects/pflash/%.c
22	$(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
23
24%.o: objects/pflash/libflash/%.c
25	$(CC) -c -o obj/$@ $< $(CFLAGS) $(INCLUDES)
26
27all: 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
28
29setup:
30	mkdir -p obj lib
31
32clean:
33	rm -rf obj lib bin/*.exe
34
35libopenbmc_intf: openbmc_intf.o
36	$(CC) -shared -o lib/$@.so obj/openbmc_intf.o $(LDFLAGS)
37
38power_control: power_control_obj.o gpio.o object_mapper.o libopenbmc_intf
39	$(CC) -o bin/$@.exe obj/gpio.o obj/power_control_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
40
41led_controller: led_controller.o
42	$(CC) -o bin/$@.exe obj/led_controller.o $(LDFLAGS) $(LIB_FLAG)
43
44button_power: button_power_obj.o gpio.o object_mapper.o libopenbmc_intf
45	$(CC) -o bin/$@.exe obj/button_power_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
46
47button_reset: button_reset_obj.o gpio.o object_mapper.o libopenbmc_intf
48	$(CC) -o bin/$@.exe obj/button_reset_obj.o obj/gpio.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
49
50
51control_host: control_host_obj.o gpio.o object_mapper.o libopenbmc_intf
52	$(CC) -o bin/$@.exe obj/gpio.o obj/control_host_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
53
54flash_bios:  flash_bios_obj.o object_mapper.o libopenbmc_intf
55	$(CC) -o bin/$@.exe obj/flash_bios_obj.o obj/object_mapper.o $(LDFLAGS) $(LIBS)
56
57host_watchdog: host_watchdog_obj.o object_mapper.o libopenbmc_intf
58	$(CC) -o bin/$@.exe obj/host_watchdog_obj.o obj/object_mapper.o  $(LDFLAGS) $(LIBS)
59
60board_vpd: board_vpd_obj.o libopenbmc_intf
61	$(CC) -o bin/$@.exe obj/board_vpd_obj.o $(LDFLAGS) $(LIBS)
62
63pcie_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)
65
66flasher:  $(OBJS2) flasher_obj.o libopenbmc_intf
67	$(CC) -o bin/$@.exe obj/flasher_obj.o $(OBJS3) $(LDFLAGS) $(LIBS)
68
69pflash:  $(OBJS2) pflash.o
70	$(CC) -o bin/$@ obj/pflash.o $(OBJS3) $(LDFLAGS)
71
72hwmons_barreleye: hwmons_barreleye.o object_mapper.o libopenbmc_intf
73	$(CC) -o bin/$@.exe obj/hwmons_barreleye.o obj/object_mapper.o  $(LDFLAGS) $(LIBS)
74
75control_bmc: control_bmc_obj.o libopenbmc_intf
76	$(CC) -o bin/$@.exe obj/control_bmc_obj.o $(LDFLAGS) $(LIBS)
77
78