blob: 1a37c0fc2463abfd12c0cb61039c04faa3f60efe [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 \
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 Austen2fb11732015-10-15 00:50:25 -050019
20
Chris Austen41a4b312015-10-25 03:45:42 -050021TESTADDSEL_OBJ = $(TESTADDSEL).o \
22 storageaddsel.o
23
Chris Austen2fb11732015-10-15 00:50:25 -050024TESTER_OBJ = ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050025 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050026
27LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050028INSTALLED_LIBS += $(LIB_APP)
29INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053030
Chris Austen41a4b312015-10-25 03:45:42 -050031INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
Chris Austen0ba649e2015-10-13 12:28:13 -050032LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050033IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053034
Patrick Williams224e2df2015-10-16 07:36:17 -050035DESTDIR ?= /
36SBINDIR ?= /usr/sbin
37INCLUDEDIR ?= /usr/include
38LIBDIR ?= /usr/lib
39
Chris Austen2fb11732015-10-15 00:50:25 -050040all: $(DAEMON) $(LIB_APP) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053041
42%.o: %.C
Chris Austen41a4b312015-10-25 03:45:42 -050043 $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
vishwabmcba0bd5f2015-09-30 16:50:23 +053044
Chris Austenac4604a2015-10-13 12:43:27 -050045$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053046 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
47
48$(DAEMON): $(DAEMON_OBJ)
49 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
50
Chris Austen2fb11732015-10-15 00:50:25 -050051$(TESTER): $(TESTER_OBJ)
52 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
53
vishwabmcba0bd5f2015-09-30 16:50:23 +053054clean:
Chris Austen2fb11732015-10-15 00:50:25 -050055 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050056
Chris Austen41a4b312015-10-25 03:45:42 -050057$(TESTADDSEL): $(TESTADDSEL_OBJ)
58 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
59
Patrick Williams224e2df2015-10-16 07:36:17 -050060install:
61 install -m 0755 -d $(DESTDIR)$(SBINDIR)
62 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
63 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
64 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
65 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
66 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
67