blob: 57ad6feae0ca07bdbceb2c0af3380b6dc66d3f93 [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
vishwa36993272015-11-20 12:43:49 -06008DAEMON_OBJ = ipmid.o host-services.o
Chris Austen41a4b312015-10-25 03:45:42 -05009
Chris Austenac4604a2015-10-13 12:43:27 -050010LIB_APP_OBJ = apphandler.o \
11 sensorhandler.o \
Chris Austenb4f5b922015-10-13 12:44:43 -050012 storagehandler.o \
Adriana Kobylak40814c62015-10-27 15:58:44 -050013 chassishandler.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 \
Adriana Kobylak5d6481f2015-10-29 21:44:55 -050017 transporthandler.o \
Chris Austen2fb11732015-10-15 00:50:25 -050018
19
Chris Austen41a4b312015-10-25 03:45:42 -050020TESTADDSEL_OBJ = $(TESTADDSEL).o \
21 storageaddsel.o
22
Chris Austen2fb11732015-10-15 00:50:25 -050023TESTER_OBJ = ipmisensor.o \
Chris Austen41a4b312015-10-25 03:45:42 -050024 testit.o
Chris Austenac4604a2015-10-13 12:43:27 -050025
26LIB_APP = libapphandler.so
Patrick Williams224e2df2015-10-16 07:36:17 -050027INSTALLED_LIBS += $(LIB_APP)
28INSTALLED_HEADERS = ipmid-api.h
vishwabmcba0bd5f2015-09-30 16:50:23 +053029
Joel Stanley29359712015-11-25 17:33:16 +103030CXXFLAGS += -Wall -Wno-unused-result
31CFLAGS += -Wall -Wno-unused-result
32
vishwa36993272015-11-20 12:43:49 -060033INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2
Chris Austen0ba649e2015-10-13 12:28:13 -050034LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic
Patrick Williams78966c22015-10-16 07:35:45 -050035IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\"
vishwabmcba0bd5f2015-09-30 16:50:23 +053036
Patrick Williams224e2df2015-10-16 07:36:17 -050037DESTDIR ?= /
38SBINDIR ?= /usr/sbin
39INCLUDEDIR ?= /usr/include
40LIBDIR ?= /usr/lib
41
Chris Austen2fb11732015-10-15 00:50:25 -050042all: $(DAEMON) $(LIB_APP) $(TESTER)
vishwabmcba0bd5f2015-09-30 16:50:23 +053043
44%.o: %.C
Chris Austen41a4b312015-10-25 03:45:42 -050045 $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@
vishwabmcba0bd5f2015-09-30 16:50:23 +053046
Chris Austenac4604a2015-10-13 12:43:27 -050047$(LIB_APP): $(LIB_APP_OBJ)
vishwabmcba0bd5f2015-09-30 16:50:23 +053048 $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@
49
50$(DAEMON): $(DAEMON_OBJ)
51 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
52
Chris Austen2fb11732015-10-15 00:50:25 -050053$(TESTER): $(TESTER_OBJ)
54 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
55
vishwabmcba0bd5f2015-09-30 16:50:23 +053056clean:
Chris Austen2fb11732015-10-15 00:50:25 -050057 rm -f $(DAEMON) $(TESTER) *.o *.so
Patrick Williams224e2df2015-10-16 07:36:17 -050058
Chris Austen41a4b312015-10-25 03:45:42 -050059$(TESTADDSEL): $(TESTADDSEL_OBJ)
60 $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl
61
Patrick Williams224e2df2015-10-16 07:36:17 -050062install:
63 install -m 0755 -d $(DESTDIR)$(SBINDIR)
64 install -m 0755 ipmid $(DESTDIR)$(SBINDIR)
65 install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid
66 install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid
67 install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid
68 install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid
69