vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 1 | CXX ?= $(CROSS_COMPILE)g++ |
| 2 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 3 | TESTER = testit |
| 4 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 5 | TESTADDSEL = testaddsel |
| 6 | |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 7 | DAEMON = ipmid |
Tom Joseph | 9a61b4f | 2016-07-11 06:56:11 -0500 | [diff] [blame] | 8 | DAEMON_OBJ = ipmid.o \ |
| 9 | ipmiwhitelist.o |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 10 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 11 | LIB_APP_OBJ = apphandler.o \ |
| 12 | sensorhandler.o \ |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 13 | storagehandler.o \ |
Adriana Kobylak | 40814c6 | 2015-10-27 15:58:44 -0500 | [diff] [blame] | 14 | chassishandler.o \ |
Chris Austen | 8a45e7c | 2015-10-15 00:31:46 -0500 | [diff] [blame] | 15 | dcmihandler.o \ |
Chris Austen | 0130d6e | 2015-10-15 22:32:36 -0500 | [diff] [blame] | 16 | ipmisensor.o \ |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 17 | storageaddsel.o \ |
Adriana Kobylak | 5d6481f | 2015-10-29 21:44:55 -0500 | [diff] [blame] | 18 | transporthandler.o \ |
Chris Austen | c2cd29d | 2016-02-05 20:02:29 -0600 | [diff] [blame] | 19 | globalhandler.o \ |
| 20 | groupext.o |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 21 | |
vishwa | b9f559a | 2016-01-13 01:53:08 -0600 | [diff] [blame] | 22 | LIB_HOST_SRV_OBJ = host-services.o |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 23 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 24 | TESTADDSEL_OBJ = $(TESTADDSEL).o \ |
| 25 | storageaddsel.o |
| 26 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 27 | TESTER_OBJ = ipmisensor.o \ |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 28 | testit.o |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 29 | |
| 30 | LIB_APP = libapphandler.so |
vishwa | b9f559a | 2016-01-13 01:53:08 -0600 | [diff] [blame] | 31 | LIB_HOST_SRV = libhostservice.so |
| 32 | |
| 33 | INSTALLED_LIBS += $(LIB_APP) $(LIB_HOST_SRV) |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 34 | INSTALLED_HEADERS = ipmid-api.h |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 35 | |
Joel Stanley | 2935971 | 2015-11-25 17:33:16 +1030 | [diff] [blame] | 36 | CXXFLAGS += -Wall -Wno-unused-result |
| 37 | CFLAGS += -Wall -Wno-unused-result |
| 38 | |
vishwa | 3699327 | 2015-11-20 12:43:49 -0600 | [diff] [blame] | 39 | INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 |
Chris Austen | 0ba649e | 2015-10-13 12:28:13 -0500 | [diff] [blame] | 40 | LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic |
Patrick Williams | 78966c2 | 2015-10-16 07:35:45 -0500 | [diff] [blame] | 41 | IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\" |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 42 | |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 43 | DESTDIR ?= / |
| 44 | SBINDIR ?= /usr/sbin |
| 45 | INCLUDEDIR ?= /usr/include |
| 46 | LIBDIR ?= /usr/lib |
| 47 | |
Matthew Barth | bc40c17 | 2016-08-10 14:56:53 -0500 | [diff] [blame^] | 48 | WHITELIST_SRC = ipmiwhitelist.cpp |
Tom Joseph | 9a61b4f | 2016-07-11 06:56:11 -0500 | [diff] [blame] | 49 | WHITELIST_CONF ?= host-ipmid-whitelist.conf |
| 50 | |
vishwa | b9f559a | 2016-01-13 01:53:08 -0600 | [diff] [blame] | 51 | all: $(DAEMON) $(LIB_APP) $(LIB_HOST_SRV) $(TESTER) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 52 | |
Tom Joseph | 9a61b4f | 2016-07-11 06:56:11 -0500 | [diff] [blame] | 53 | $(WHITELIST_SRC) : generate_whitelist.sh $(WHITELIST_CONF) |
| 54 | ./$^ > $@ |
| 55 | |
Matthew Barth | 98a2384 | 2016-08-08 15:26:29 -0500 | [diff] [blame] | 56 | %.o: %.cpp |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 57 | $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@ |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 58 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 59 | $(LIB_APP): $(LIB_APP_OBJ) |
Brad Bishop | 3551868 | 2016-07-22 08:35:41 -0400 | [diff] [blame] | 60 | $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 61 | |
vishwa | b9f559a | 2016-01-13 01:53:08 -0600 | [diff] [blame] | 62 | $(LIB_HOST_SRV): $(LIB_HOST_SRV_OBJ) |
| 63 | $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ |
| 64 | |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 65 | $(DAEMON): $(DAEMON_OBJ) |
Brad Bishop | 3551868 | 2016-07-22 08:35:41 -0400 | [diff] [blame] | 66 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -lmapper -ldl |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 67 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 68 | $(TESTER): $(TESTER_OBJ) |
| 69 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
| 70 | |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 71 | clean: |
Tom Joseph | 9a61b4f | 2016-07-11 06:56:11 -0500 | [diff] [blame] | 72 | rm -f $(DAEMON) $(TESTER) *.o *.so $(WHITELIST_SRC) |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 73 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 74 | $(TESTADDSEL): $(TESTADDSEL_OBJ) |
| 75 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
Tom Joseph | 9a61b4f | 2016-07-11 06:56:11 -0500 | [diff] [blame] | 76 | |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 77 | install: |
| 78 | install -m 0755 -d $(DESTDIR)$(SBINDIR) |
| 79 | install -m 0755 ipmid $(DESTDIR)$(SBINDIR) |
| 80 | install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid |
| 81 | install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid |
| 82 | install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid |
| 83 | install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid |
| 84 | |
Tom Joseph | 9a61b4f | 2016-07-11 06:56:11 -0500 | [diff] [blame] | 85 | |