blob: cf1d9cb3b90f8a63975eaa564a9074c1af670a5c [file] [log] [blame]
vishwabmcba0bd5f2015-09-30 16:50:23 +05301CXX ?= $(CROSS_COMPILE)g++
2
3DAEMON = ipmid
Chris Austenac4604a2015-10-13 12:43:27 -05004DAEMON_OBJ = $(DAEMON).o
5LIB_APP_OBJ = apphandler.o \
6 sensorhandler.o \
Chris Austenb4f5b922015-10-13 12:44:43 -05007 storagehandler.o \
Chris Austen1810bec2015-10-13 12:12:39 -05008 dcmihandler.o
Chris Austenac4604a2015-10-13 12:43:27 -05009
10LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050011INSTALLED_LIBS += $(LIB_APP)
12INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053013
Chris Austen0ba649e2015-10-13 12:28:13 -050014INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 --std=gnu++11
15LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050016IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053017
Patrick Williams224e2df2015-10-16 07:36:17 -050018DESTDIR ?= /
19SBINDIR ?= /usr/sbin
20INCLUDEDIR ?= /usr/include
21LIBDIR ?= /usr/lib
22
Patrick Williams78966c22015-10-16 07:35:45 -050023all: $(DAEMON) $(LIB_APP)
vishwabmcba0bd5f2015-09-30 16:50:23 +053024
25%.o: %.C
26 $(CXX) -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
27
Chris Austenac4604a2015-10-13 12:43:27 -050028$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053029 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
30
31$(DAEMON): $(DAEMON_OBJ)
32 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
33
34clean:
35 rm -f $(DAEMON) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050036
37install:
38 install -m 0755 -d $(DESTDIR)$(SBINDIR)
39 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
40 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
41 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
42 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
43 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
44