blob: cdb396bfc9faf29ac607813026c4ffb701ff3b60 [file] [log] [blame]
vishwabmcba0bd5f2015-09-30 16:50:23 +05301CXX ?= $(CROSS_COMPILE)g++
2
Chris Austen2fb11732015-10-15 00:50:25 -05003TESTER = testit
4
Chris Austen41a4b312015-10-25 03:45:42 -05005TESTADDSEL = testaddsel
6
vishwabmcba0bd5f2015-09-30 16:50:23 +05307DAEMON = ipmid
Tom Joseph9a61b4f2016-07-11 06:56:11 -05008DAEMON_OBJ = ipmid.o \
9 ipmiwhitelist.o
Chris Austen41a4b312015-10-25 03:45:42 -050010
Chris Austenac4604a2015-10-13 12:43:27 -050011LIB_APP_OBJ = apphandler.o \
12 sensorhandler.o \
Chris Austenb4f5b922015-10-13 12:44:43 -050013 storagehandler.o \
Adriana Kobylak40814c62015-10-27 15:58:44 -050014 chassishandler.o \
Chris Austen8a45e7c2015-10-15 00:31:46 -050015 dcmihandler.o \
Chris Austen0130d6e2015-10-15 22:32:36 -050016 ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050017 storageaddsel.o \
Adriana Kobylak5d6481f2015-10-29 21:44:55 -050018 transporthandler.o \
Chris Austenc2cd29d2016-02-05 20:02:29 -060019 globalhandler.o \
20 groupext.o
Chris Austen2fb11732015-10-15 00:50:25 -050021
vishwab9f559a2016-01-13 01:53:08 -060022LIB_HOST_SRV_OBJ = host-services.o
Chris Austen2fb11732015-10-15 00:50:25 -050023
Chris Austen41a4b312015-10-25 03:45:42 -050024TESTADDSEL_OBJ = $(TESTADDSEL).o \
25 storageaddsel.o
26
Chris Austen2fb11732015-10-15 00:50:25 -050027TESTER_OBJ = ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050028 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050029
30LIB_APP = libapphandler.so
vishwab9f559a2016-01-13 01:53:08 -060031LIB_HOST_SRV = libhostservice.so
32
33INSTALLED_LIBS += $(LIB_APP) $(LIB_HOST_SRV)
Patrick Williams224e2df2015-10-16 07:36:17 -050034INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053035
Joel Stanley29359712015-11-25 17:33:16 +103036CXXFLAGS += -Wall -Wno-unused-result
37CFLAGS += -Wall -Wno-unused-result
38
vishwa36993272015-11-20 12:43:49 -060039INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
Chris Austen0ba649e2015-10-13 12:28:13 -050040LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050041IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053042
Patrick Williams224e2df2015-10-16 07:36:17 -050043DESTDIR ?= /
44SBINDIR ?= /usr/sbin
45INCLUDEDIR ?= /usr/include
46LIBDIR ?= /usr/lib
47
Matthew Barthbc40c172016-08-10 14:56:53 -050048WHITELIST_SRC = ipmiwhitelist.cpp
Tom Joseph9a61b4f2016-07-11 06:56:11 -050049WHITELIST_CONF ?= host-ipmid-whitelist.conf
50
vishwab9f559a2016-01-13 01:53:08 -060051all: $(DAEMON) $(LIB_APP) $(LIB_HOST_SRV) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053052
Tom Joseph9a61b4f2016-07-11 06:56:11 -050053$(WHITELIST_SRC) : generate_whitelist.sh $(WHITELIST_CONF)
54 ./$^ > $@
55
Matthew Barth98a23842016-08-08 15:26:29 -050056%.o: %.cpp
Chris Austen41a4b312015-10-25 03:45:42 -050057 $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
vishwabmcba0bd5f2015-09-30 16:50:23 +053058
Chris Austenac4604a2015-10-13 12:43:27 -050059$(LIB_APP): $(LIB_APP_OBJ)
Brad Bishop35518682016-07-22 08:35:41 -040060 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper
vishwabmcba0bd5f2015-09-30 16:50:23 +053061
vishwab9f559a2016-01-13 01:53:08 -060062$(LIB_HOST_SRV): $(LIB_HOST_SRV_OBJ)
63 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
64
vishwabmcba0bd5f2015-09-30 16:50:23 +053065$(DAEMON): $(DAEMON_OBJ)
Brad Bishop35518682016-07-22 08:35:41 -040066 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper -ldl
vishwabmcba0bd5f2015-09-30 16:50:23 +053067
Chris Austen2fb11732015-10-15 00:50:25 -050068$(TESTER): $(TESTER_OBJ)
69 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
70
vishwabmcba0bd5f2015-09-30 16:50:23 +053071clean:
Tom Joseph9a61b4f2016-07-11 06:56:11 -050072 rm -f $(DAEMON) $(TESTER) *.o *.so $(WHITELIST_SRC)
Patrick Williams224e2df2015-10-16 07:36:17 -050073
Chris Austen41a4b312015-10-25 03:45:42 -050074$(TESTADDSEL): $(TESTADDSEL_OBJ)
75 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
Tom Joseph9a61b4f2016-07-11 06:56:11 -050076
Patrick Williams224e2df2015-10-16 07:36:17 -050077install:
78 install -m 0755 -d $(DESTDIR)$(SBINDIR)
79 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
80 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
81 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
82 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
83 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
84
Tom Joseph9a61b4f2016-07-11 06:56:11 -050085