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