vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 1 | CXX ?= $(CROSS_COMPILE)g++ |
| 2 | |
| 3 | DAEMON = ipmid |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 4 | DAEMON_OBJ = $(DAEMON).o |
| 5 | LIB_APP_OBJ = apphandler.o \ |
| 6 | sensorhandler.o \ |
Chris Austen | b4f5b92 | 2015-10-13 12:44:43 -0500 | [diff] [blame] | 7 | storagehandler.o \ |
Chris Austen | 1810bec | 2015-10-13 12:12:39 -0500 | [diff] [blame] | 8 | dcmihandler.o |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 9 | |
| 10 | LIB_APP = libapphandler.so |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame^] | 11 | INSTALLED_LIBS += $(LIB_APP) |
| 12 | INSTALLED_HEADERS = ipmid-api.h |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 13 | |
Chris Austen | 0ba649e | 2015-10-13 12:28:13 -0500 | [diff] [blame] | 14 | INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 --std=gnu++11 |
| 15 | LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic |
Patrick Williams | 78966c2 | 2015-10-16 07:35:45 -0500 | [diff] [blame] | 16 | IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\" |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 17 | |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame^] | 18 | DESTDIR ?= / |
| 19 | SBINDIR ?= /usr/sbin |
| 20 | INCLUDEDIR ?= /usr/include |
| 21 | LIBDIR ?= /usr/lib |
| 22 | |
Patrick Williams | 78966c2 | 2015-10-16 07:35:45 -0500 | [diff] [blame] | 23 | all: $(DAEMON) $(LIB_APP) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 24 | |
| 25 | %.o: %.C |
| 26 | $(CXX) -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@ |
| 27 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame] | 28 | $(LIB_APP): $(LIB_APP_OBJ) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 29 | $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ |
| 30 | |
| 31 | $(DAEMON): $(DAEMON_OBJ) |
| 32 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
| 33 | |
| 34 | clean: |
| 35 | rm -f $(DAEMON) *.o *.so |
Patrick Williams | 224e2df | 2015-10-16 07:36:17 -0500 | [diff] [blame^] | 36 | |
| 37 | install: |
| 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 | |