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 \ |
| 7 | |
| 8 | LIB_APP = libapphandler.so |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 9 | |
Chris Austen | 0ba649e | 2015-10-13 12:28:13 -0500 | [diff] [blame] | 10 | INC_FLAG += $(shell pkg-config --cflags --libs libsystemd) -I. -O2 --std=gnu++11 |
| 11 | LIB_FLAG += $(shell pkg-config --libs libsystemd) -rdynamic |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 12 | IPMID_PATH ?= -DHOST_IPMI_LIB_PATH=\"/usr/lib/host-ipmid/\" |
| 13 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame^] | 14 | all: $(DAEMON) $(LIB_APP) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 15 | |
| 16 | %.o: %.C |
| 17 | $(CXX) -fpic -c $< $(CXXFLAGS) $(INC_FLAG) $(IPMID_PATH) -o $@ |
| 18 | |
Chris Austen | ac4604a | 2015-10-13 12:43:27 -0500 | [diff] [blame^] | 19 | $(LIB_APP): $(LIB_APP_OBJ) |
vishwabmc | ba0bd5f | 2015-09-30 16:50:23 +0530 | [diff] [blame] | 20 | $(CXX) $^ -shared $(LDFLAGS) $(LIB_FLAG) -o $@ |
| 21 | |
| 22 | $(DAEMON): $(DAEMON_OBJ) |
| 23 | $(CXX) $^ $(LDFLAGS) $(LIB_FLAG) -o $@ -ldl |
| 24 | |
| 25 | clean: |
| 26 | rm -f $(DAEMON) *.o *.so |