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 |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 8 | DAEMON_OBJ = $(DAEMON).o |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 9 | |
| 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 \ |
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 \ |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 17 | |
| 18 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 19 | TESTADDSEL_OBJ = $(TESTADDSEL).o \ |
| 20 | storageaddsel.o |
| 21 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 22 | TESTER_OBJ = ipmisensor.o \ |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 23 | testit.o |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 24 | |
| 25 | LIB_APP = libapphandler.so |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 26 | INSTALLED_LIBS += $(LIB_APP) |
| 27 | INSTALLED_HEADERS = ipmid-api.h |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 28 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 29 | INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 |
Chris Austen | 0ba649e | 2015-10-13 12:28:13 -0500 | [diff] [blame] | 30 | LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic |
Patrick Williams | 78966c2 | 2015-10-16 07:35:45 -0500 | [diff] [blame] | 31 | IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\" |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 32 | |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 33 | DESTDIR ?= / |
| 34 | SBINDIR ?= /usr/sbin |
| 35 | INCLUDEDIR ?= /usr/include |
| 36 | LIBDIR ?= /usr/lib |
| 37 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 38 | all: $(DAEMON) $(LIB_APP) $(TESTER) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 39 | |
| 40 | %.o: %.C |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 41 | $(CXX) -std=c++14 -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@ |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 42 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 43 | $(LIB_APP): $(LIB_APP_OBJ) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 44 | $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ |
| 45 | |
| 46 | $(DAEMON): $(DAEMON_OBJ) |
| 47 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
| 48 | |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 49 | $(TESTER): $(TESTER_OBJ) |
| 50 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
| 51 | |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 52 | clean: |
Chris Austen | 2fb1173 | 2015-10-15 00:50:25 -0500 | [diff] [blame] | 53 | rm -f $(DAEMON) $(TESTER) *.o *.so |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 54 | |
Chris Austen | 41a4b31 | 2015-10-25 03:45:42 -0500 | [diff] [blame] | 55 | $(TESTADDSEL): $(TESTADDSEL_OBJ) |
| 56 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
| 57 | |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame] | 58 | install: |
| 59 | install -m 0755 -d $(DESTDIR)$(SBINDIR) |
| 60 | install -m 0755 ipmid $(DESTDIR)$(SBINDIR) |
| 61 | install -m 0755 -d $(DESTDIR)$(LIBDIR)/host-ipmid |
| 62 | install -m 0755 $(INSTALLED_LIBS) $(DESTDIR)$(LIBDIR)/host-ipmid |
| 63 | install -m 0755 -d $(DESTDIR)$(INCLUDEDIR)/host-ipmid |
| 64 | install -m 0644 $(INSTALLED_HEADERS) $(DESTDIR)$(INCLUDEDIR)/host-ipmid |
| 65 | |