blob: 45e3d0f3ab9d06afe0ada3d21e6969bbc84ed3b4 [file] [log] [blame]
vishwabmcba0bd5f2015-09-30 16:50:23 +05301CXX ?= $(CROSS_COMPILE)g++
2
Chris Austen2fb11732015-10-15 00:50:25 -05003TESTER = testit
4
vishwabmcba0bd5f2015-09-30 16:50:23 +05305DAEMON = ipmid
Chris Austenac4604a2015-10-13 12:43:27 -05006DAEMON_OBJ = $(DAEMON).o
7LIB_APP_OBJ = apphandler.o \
8 sensorhandler.o \
Chris Austenb4f5b922015-10-13 12:44:43 -05009 storagehandler.o \
Chris Austen8a45e7c2015-10-15 00:31:46 -050010 dcmihandler.o \
Chris Austen2fb11732015-10-15 00:50:25 -050011
12
13TESTER_OBJ = ipmisensor.o \
14 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050015
16LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050017INSTALLED_LIBS += $(LIB_APP)
18INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053019
Chris Austen0ba649e2015-10-13 12:28:13 -050020INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 --std=gnu++11
21LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050022IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053023
Patrick Williams224e2df2015-10-16 07:36:17 -050024DESTDIR ?= /
25SBINDIR ?= /usr/sbin
26INCLUDEDIR ?= /usr/include
27LIBDIR ?= /usr/lib
28
Chris Austen2fb11732015-10-15 00:50:25 -050029all: $(DAEMON) $(LIB_APP) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053030
31%.o: %.C
32 $(CXX) -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
33
Chris Austenac4604a2015-10-13 12:43:27 -050034$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053035 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
36
37$(DAEMON): $(DAEMON_OBJ)
38 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
39
Chris Austen2fb11732015-10-15 00:50:25 -050040$(TESTER): $(TESTER_OBJ)
41 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
42
vishwabmcba0bd5f2015-09-30 16:50:23 +053043clean:
Chris Austen2fb11732015-10-15 00:50:25 -050044 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050045
46install:
47 install -m 0755 -d $(DESTDIR)$(SBINDIR)
48 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
49 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
50 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
51 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
52 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
53