blob: a91328ea67b889add7e1d474eeeb2d8c1ee3c809 [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
Chris Austenac4604a2015-10-13 12:43:27 -05008DAEMON_OBJ = $(DAEMON).o
Chris Austen41a4b312015-10-25 03:45:42 -05009
10
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 \
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 \
Chris Austen2fb11732015-10-15 00:50:25 -050017
18
Chris Austen41a4b312015-10-25 03:45:42 -050019TESTADDSEL_OBJ = $(TESTADDSEL).o \
20 storageaddsel.o
21
Chris Austen2fb11732015-10-15 00:50:25 -050022TESTER_OBJ = ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050023 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050024
25LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050026INSTALLED_LIBS += $(LIB_APP)
27INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053028
Chris Austen41a4b312015-10-25 03:45:42 -050029INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
Chris Austen0ba649e2015-10-13 12:28:13 -050030LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050031IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053032
Patrick Williams224e2df2015-10-16 07:36:17 -050033DESTDIR ?= /
34SBINDIR ?= /usr/sbin
35INCLUDEDIR ?= /usr/include
36LIBDIR ?= /usr/lib
37
Chris Austen2fb11732015-10-15 00:50:25 -050038all: $(DAEMON) $(LIB_APP) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053039
40%.o: %.C
Chris Austen41a4b312015-10-25 03:45:42 -050041 $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
vishwabmcba0bd5f2015-09-30 16:50:23 +053042
Chris Austenac4604a2015-10-13 12:43:27 -050043$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053044 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
45
46$(DAEMON): $(DAEMON_OBJ)
47 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
48
Chris Austen2fb11732015-10-15 00:50:25 -050049$(TESTER): $(TESTER_OBJ)
50 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
51
vishwabmcba0bd5f2015-09-30 16:50:23 +053052clean:
Chris Austen2fb11732015-10-15 00:50:25 -050053 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050054
Chris Austen41a4b312015-10-25 03:45:42 -050055$(TESTADDSEL): $(TESTADDSEL_OBJ)
56 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
57
Patrick Williams224e2df2015-10-16 07:36:17 -050058install:
59 install -m 0755 -d $(DESTDIR)$(SBINDIR)
60 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
61 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
62 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
63 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
64 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
65