blob: 7a3b6af1cfac15f6c2480c594f26b3bba47e8836 [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
vishwab9f559a2016-01-13 01:53:08 -06008DAEMON_OBJ = ipmid.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 Austenc2cd29d2016-02-05 20:02:29 -060018 globalhandler.o \
19 groupext.o
Chris Austen2fb11732015-10-15 00:50:25 -050020
vishwab9f559a2016-01-13 01:53:08 -060021LIB_HOST_SRV_OBJ = host-services.o
Chris Austen2fb11732015-10-15 00:50:25 -050022
Chris Austen41a4b312015-10-25 03:45:42 -050023TESTADDSEL_OBJ = $(TESTADDSEL).o \
24 storageaddsel.o
25
Chris Austen2fb11732015-10-15 00:50:25 -050026TESTER_OBJ = ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050027 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050028
29LIB_APP = libapphandler.so
vishwab9f559a2016-01-13 01:53:08 -060030LIB_HOST_SRV = libhostservice.so
31
32INSTALLED_LIBS += $(LIB_APP) $(LIB_HOST_SRV)
Patrick Williams224e2df2015-10-16 07:36:17 -050033INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053034
Joel Stanley29359712015-11-25 17:33:16 +103035CXXFLAGS += -Wall -Wno-unused-result
36CFLAGS += -Wall -Wno-unused-result
37
vishwa36993272015-11-20 12:43:49 -060038INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
Chris Austen0ba649e2015-10-13 12:28:13 -050039LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050040IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053041
Patrick Williams224e2df2015-10-16 07:36:17 -050042DESTDIR ?= /
43SBINDIR ?= /usr/sbin
44INCLUDEDIR ?= /usr/include
45LIBDIR ?= /usr/lib
46
vishwab9f559a2016-01-13 01:53:08 -060047all: $(DAEMON) $(LIB_APP) $(LIB_HOST_SRV) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053048
49%.o: %.C
Chris Austen41a4b312015-10-25 03:45:42 -050050 $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
vishwabmcba0bd5f2015-09-30 16:50:23 +053051
Chris Austenac4604a2015-10-13 12:43:27 -050052$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053053 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
54
vishwab9f559a2016-01-13 01:53:08 -060055$(LIB_HOST_SRV): $(LIB_HOST_SRV_OBJ)
56 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
57
vishwabmcba0bd5f2015-09-30 16:50:23 +053058$(DAEMON): $(DAEMON_OBJ)
59 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
60
Chris Austen2fb11732015-10-15 00:50:25 -050061$(TESTER): $(TESTER_OBJ)
62 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
63
vishwabmcba0bd5f2015-09-30 16:50:23 +053064clean:
Chris Austen2fb11732015-10-15 00:50:25 -050065 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050066
Chris Austen41a4b312015-10-25 03:45:42 -050067$(TESTADDSEL): $(TESTADDSEL_OBJ)
68 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
69
Patrick Williams224e2df2015-10-16 07:36:17 -050070install:
71 install -m 0755 -d $(DESTDIR)$(SBINDIR)
72 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
73 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
74 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
75 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
76 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
77