blob: 1851c9f646f6bdd0506ed6e07e33693884cf9c87 [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
vishwa36993272015-11-20 12:43:49 -06008DAEMON_OBJ = ipmid.o host-services.o
Chris Austen41a4b312015-10-25 03:45:42 -05009
Chris Austenac4604a2015-10-13 12:43:27 -050010LIB_APP_OBJ = apphandler.o \
11 sensorhandler.o \
Chris Austenb4f5b922015-10-13 12:44:43 -050012 storagehandler.o \
Adriana Kobylak40814c62015-10-27 15:58:44 -050013 chassishandler.o \
Chris Austen8a45e7c2015-10-15 00:31:46 -050014 dcmihandler.o \
Chris Austen0130d6e2015-10-15 22:32:36 -050015 ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050016 storageaddsel.o \
Adriana Kobylak5d6481f2015-10-29 21:44:55 -050017 transporthandler.o \
Chris Austen2fb11732015-10-15 00:50:25 -050018
19
Chris Austen41a4b312015-10-25 03:45:42 -050020TESTADDSEL_OBJ = $(TESTADDSEL).o \
21 storageaddsel.o
22
Chris Austen2fb11732015-10-15 00:50:25 -050023TESTER_OBJ = ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050024 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050025
26LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050027INSTALLED_LIBS += $(LIB_APP)
28INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053029
vishwa36993272015-11-20 12:43:49 -060030INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
Chris Austen0ba649e2015-10-13 12:28:13 -050031LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050032IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053033
Patrick Williams224e2df2015-10-16 07:36:17 -050034DESTDIR ?= /
35SBINDIR ?= /usr/sbin
36INCLUDEDIR ?= /usr/include
37LIBDIR ?= /usr/lib
38
Chris Austen2fb11732015-10-15 00:50:25 -050039all: $(DAEMON) $(LIB_APP) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053040
41%.o: %.C
Chris Austen41a4b312015-10-25 03:45:42 -050042 $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
vishwabmcba0bd5f2015-09-30 16:50:23 +053043
Chris Austenac4604a2015-10-13 12:43:27 -050044$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053045 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
46
47$(DAEMON): $(DAEMON_OBJ)
48 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
49
Chris Austen2fb11732015-10-15 00:50:25 -050050$(TESTER): $(TESTER_OBJ)
51 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
52
vishwabmcba0bd5f2015-09-30 16:50:23 +053053clean:
Chris Austen2fb11732015-10-15 00:50:25 -050054 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050055
Chris Austen41a4b312015-10-25 03:45:42 -050056$(TESTADDSEL): $(TESTADDSEL_OBJ)
57 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
58
Patrick Williams224e2df2015-10-16 07:36:17 -050059install:
60 install -m 0755 -d $(DESTDIR)$(SBINDIR)
61 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
62 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
63 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
64 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
65 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
66