Makefile 2.81 KB
Newer Older
1
2
3
4
5
6
7
8
TARGET = dcdbpusher

DCDBBASEPATH ?= $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/..)
DCDBCOREPATH ?= $(DCDBBASEPATH)/dcdb

include $(realpath $(dir $(lastword $(MAKEFILE_LIST)))/../..)/dcdb/common.mk

CXXFLAGS = -std=c++0x -O2 -g -Wall -Werror -Wno-unused-local-typedefs -Wno-unknown-warning-option -Wno-deprecated-declarations -I$(DCDBDEPLOYPATH)/include -I$(DCDBBASEPATH)/include
9
CXXFLAGS =	-std=c++11 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -O2 -g -Wall -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-variable -DBOOST_LOG_DYN_LINK -I$(DCDBBASEPATH)/dcdb/include -I$(DCDBDEPLOYPATH)/include
10
PLUGINFLAGS = -fPIC -c $(CXXFLAGS)
11
LIBS = -L../deps/mosquitto_build/lib -L$(DCDBDEPLOYPATH)/lib/ -ldl -lmosquitto -lboost_system -lboost_thread -lboost_log_setup -lboost_log -lpthread -rdynamic
12
OBJS = dcdbpusher.o Configuration.o Sensor.o MQTTPusher.o
13
PLUGINS = libdcdbplugin_pdu.so.1.0 libdcdbplugin_perfevent.so.1.0 libdcdbplugin_sysfs.so.1.0 libdcdbplugin_ipmi.so.1.0 libdcdbplugin_bacnet.so.1.0
14

15
$(TARGET):	$(PLUGINS) $(OBJS)
16
17
18
19
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)
	
all:	$(TARGET)

20
21
22
debug: CXXFLAGS += -DDEBUG
debug: $(TARGET)

23
clean:
24
	rm -f *.o *.so* $(TARGET)
25
26
27
28

install: $(TARGET)
	install $(TARGET) $(DCDBDEPLOYPATH)/bin/
	install -m 644 $(TARGET).conf $(DCDBDEPLOYPATH)/etc
29

30
31
32
libdcdbplugin_sysfs.so.1.0:
	$(CXX) $(PLUGINFLAGS) sensors/sysfs/SysfsSensor.cpp
	$(CXX) $(PLUGINFLAGS) sensors/sysfs/SysfsConfigurator.cpp
33
	$(CXX) -shared -Wl,-soname,libdcdbplugin_sysfs.so.1 -o libdcdbplugin_sysfs.so.1.0 SysfsSensor.o SysfsConfigurator.o
34
35
36
37

libdcdbplugin_perfevent.so.1.0:
	$(CXX) $(PLUGINFLAGS) sensors/perfevent/PerfCounter.cpp
	$(CXX) $(PLUGINFLAGS) sensors/perfevent/PerfeventConfigurator.cpp
38
	$(CXX) -shared -Wl,-soname,libdcdbplugin_perfevent.so.1 -o libdcdbplugin_perfevent.so.1.0 PerfCounter.o PerfeventConfigurator.o
39
40

libdcdbplugin_ipmi.so.1.0:
41
42
43
44
	$(CXX) $(PLUGINFLAGS) sensors/ipmi/IPMISensor.cpp
	$(CXX) $(PLUGINFLAGS) sensors/ipmi/IPMIHost.cpp
	$(CXX) $(PLUGINFLAGS) sensors/ipmi/IPMIConfigurator.cpp
	$(CXX) -shared -Wl,-soname,libdcdbplugin_ipmi.so.1 -o libdcdbplugin_ipmi.so.1.0 IPMISensor.o IPMIHost.o IPMIConfigurator.o -L$(DCDBDEPLOYPATH)/lib/ -lfreeipmi -lboost_regex
45
46
47
48
49

libdcdbplugin_pdu.so.1.0:
	$(CXX) $(PLUGINFLAGS) sensors/pdu/PDUSensor.cpp
	$(CXX) $(PLUGINFLAGS) sensors/pdu/PDUUnit.cpp
	$(CXX) $(PLUGINFLAGS) sensors/pdu/PDUConfigurator.cpp
50
	$(CXX) -shared -Wl,-soname,libdcdbplugin_pdu.so.1 -o libdcdbplugin_pdu.so.1.0 PDUSensor.o PDUUnit.o PDUConfigurator.o -L$(DCDBDEPLOYPATH)/lib/ -lcrypto -lssl
51
52
53
54
55
56
	
libdcdbplugin_bacnet.so.1.0:
	$(CXX) $(PLUGINFLAGS) sensors/bacnet/BACnetSensor.cpp
	$(CXX) $(PLUGINFLAGS) sensors/bacnet/BACnetClient.cpp
	$(CXX) $(PLUGINFLAGS) sensors/bacnet/BACnetConfigurator.cpp
	$(CXX) -shared -Wl,-soname,libdcdbplugin_bacnet.so.1 -o libdcdbplugin_bacnet.so.1.0 BACnetSensor.o BACnetClient.o BACnetConfigurator.o -lbacnet