blob: 1f2c7aa632a312d3c95118220b3dde0becb3c46e [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 Austen0130d6e2015-10-15 22:32:36 -050011 ipmisensor.o \
Chris Austen2fb11732015-10-15 00:50:25 -050012
13
14TESTER_OBJ = ipmisensor.o \
15 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050016
17LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050018INSTALLED_LIBS += $(LIB_APP)
19INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053020
Chris Austen0ba649e2015-10-13 12:28:13 -050021INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 --std=gnu++11
22LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050023IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053024
Patrick Williams224e2df2015-10-16 07:36:17 -050025DESTDIR ?= /
26SBINDIR ?= /usr/sbin
27INCLUDEDIR ?= /usr/include
28LIBDIR ?= /usr/lib
29
Chris Austen2fb11732015-10-15 00:50:25 -050030all: $(DAEMON) $(LIB_APP) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053031
32%.o: %.C
33 $(CXX) -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
34
Chris Austenac4604a2015-10-13 12:43:27 -050035$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053036 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
37
38$(DAEMON): $(DAEMON_OBJ)
39 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
40
Chris Austen2fb11732015-10-15 00:50:25 -050041$(TESTER): $(TESTER_OBJ)
42 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
43
vishwabmcba0bd5f2015-09-30 16:50:23 +053044clean:
Chris Austen2fb11732015-10-15 00:50:25 -050045 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050046
47install:
48 install -m 0755 -d $(DESTDIR)$(SBINDIR)
49 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
50 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
51 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
52 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
53 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
54