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

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

BACNET-STACK_VERSION = 0.8.5
FREEIPMI_VERSION = 1.5.5
8
NET-SNMP_VERSION = 5.7.3
9
DISTFILES = 	bacnet-stack-$(BACNET-STACK_VERSION).tgz;https://downloads.sourceforge.net/project/bacnet/bacnet-stack/bacnet-stack-$(BACNET-STACK_VERSION)/bacnet-stack-$(BACNET-STACK_VERSION).tgz \
10
11
12
		freeipmi-$(FREEIPMI_VERSION).tar.gz;http://ftp.gnu.org/gnu/freeipmi/freeipmi-$(FREEIPMI_VERSION).tar.gz \
		net-snmp-$(NET-SNMP_VERSION).tar.gz;https://sourceforge.net/projects/net-snmp/files/net-snmp/$(NET-SNMP_VERSION)/net-snmp-$(NET-SNMP_VERSION).tar.gz/download
DISTFILES_HASHES = bacnet-stack-$(BACNET-STACK_VERSION).tgz|66b69111d91432fa67a7c6c1a653434d;freeipmi-$(FREEIPMI_VERSION).tar.gz|b8abfefee0b757f351d8fab777e3c1bb;net-snmp-$(NET-SNMP_VERSION).tar.gz|d4a3459e1577d0efa8d96ca70a885e53
13
14
15

include $(DCDBCOREPATH)/common.mk

Michael Ott's avatar
Michael Ott committed
16
VERSION = $(shell git describe --long|sed 's/-\([0-9]*\)/.\1/')
17
18

CXXFLAGS =	-std=c++11 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -DBOOST_NETWORK_ENABLE_HTTPS -O2 -g -Wall -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-variable -DBOOST_LOG_DYN_LINK -I$(DCDBBASEPATH)/dcdb/include -I$(DCDBDEPLOYPATH)/include -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/asio/asio/include -DVERSION=\"$(VERSION)\"
19
LIBS = -L../deps/mosquitto_build/lib -L$(DCDBDEPLOYPATH)/lib/ -ldl -lmosquitto -lboost_system -lboost_thread -lboost_log_setup -lboost_log -lboost_regex -lpthread -lcrypto -lssl -lcppnetlib-server-parsers -lcppnetlib-uri -rdynamic
20
OBJS = src/dcdbpusher.o src/Configuration.o src/MQTTPusher.o src/HttpsServer.o src/analytics/AnalyticsManager.o src/analytics/SensorNavigator.o
21

Michael Ott's avatar
Michael Ott committed
22
PLUGINS = procfs pdu sysfs ipmi bacnet snmp gpfsmon tester
23
24
ANALYZERS = average

25
26
27
28
29
30
31
32
ifeq ($(OS),Darwin)
	BACNET_PORT = bsd
	LIBEXT = dylib
	LIBFLAGS = -dynamiclib -install_name
else
	BACNET_PORT = linux
	LIBEXT = so
	LIBFLAGS = -shared -Wl,-soname,
33
        PLUGINS+= perfevent
34
35
	PLUGINFLAGS = -fPIC
endif
36
PLUGIN_LIBS = $(foreach p,$(PLUGINS),libdcdbplugin_$(p).$(LIBEXT))
37
ANALYZER_LIBS = $(foreach p,$(ANALYZERS),libdcdbanalyzer_$(p).$(LIBEXT))
38
39
40
41

$(TARGET): $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.installed) $(OBJS)
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)

42
all:	$(TARGET) $(PLUGIN_LIBS) $(ANALYZER_LIBS)
43
44
45
46
debug: CXXFLAGS += -DDEBUG
debug: all

clean:
47
	rm -f $(PLUGIN_LIBS) $(ANALYZER_LIBS) $(TARGET) $(shell find -name "*.o")
48

49
$(DCDBDEPSPATH)/bacnet-stack-$(BACNET-STACK_VERSION)/.installed: $(DCDBDEPSPATH)/bacnet-stack-$(BACNET-STACK_VERSION)/.patched
50
51
52
53
54
	@echo ""
	@echo "Building BACNet-Stack..."
	cd $(@D) && BACNET_PORT=$(BACNET_PORT) MAKE_DEFINE=-fpic make -j $(MAKETHREADS) library && \
	install $(DCDBDEPSPATH)/bacnet-stack-$(BACNET-STACK_VERSION)/lib/libbacnet.a /$(DCDBDEPLOYPATH)/lib/ && touch $(@)

55
$(DCDBDEPSPATH)/freeipmi-$(FREEIPMI_VERSION)/.installed: $(DCDBDEPSPATH)/freeipmi-$(FREEIPMI_VERSION)/.patched
56
57
58
59
	@echo ""
	@echo "Building FreeIPMI library..."
	cd $(@D) && ./configure --prefix=$(DCDBDEPLOYPATH) --without-argp
	cd $(@D) && make -j $(MAKETHREADS) && make install && touch $(@)
60
61

$(DCDBDEPSPATH)/net-snmp-$(NET-SNMP_VERSION)/.installed: $(DCDBDEPSPATH)/net-snmp-$(NET-SNMP_VERSION)/.patched
62
63
64
65
	@echo ""
	@echo "Building net-SNMP library..."
	cd $(@D) && ./configure --prefix=$(DCDBDEPLOYPATH) --with-default-snmp-version=3 --with-sys-contact= --with-sys-location= --with-logfile=none --with-persistent-directory=$(DCDBDEPLOYPATH)/var/net-snmp --disable-embedded-perl --disable-perl-cc-checks --without-perl-modules --disable-agent --disable-applications --disable-manuals --disable-scripts --disable-mibs
	cd $(@D) && make -j $(MAKETHREADS) && make install && touch $(@)
66
67
68

$(OBJS)	: %.o : %.cpp

69
70
71
install_lib: $(PLUGIN_LIBS)
	install $^ $(DCDBDEPLOYPATH)/lib/

72
73
74
75
install_analyzer: $(ANALYZER_LIBS)
	install $^ $(DCDBDEPLOYPATH)/lib/

install_conf: $(foreach p,global $(PLUGINS) $(ANALYZERS),config/$(p).conf)
76
77
	install -m 644 $^ $(DCDBDEPLOYPATH)/etc/

78
install: $(TARGET) install_lib install_analyzer
79
	install $(TARGET) $(DCDBDEPLOYPATH)/bin/
80
81
82
83
	@echo "Done with installation."
	@echo "====================================="
	@echo "To copy the configuration files type:"
	@echo "				     > make install_conf"
84

85
src/Sensor.o: CXXFLAGS+= $(PLUGINFLAGS)
86
src/SensorGroup.o: CXXFLAGS+= $(PLUGINFLAGS)
87
88
89
src/sensors/%.o: CXXFLAGS+= $(PLUGINFLAGS) -I$(DCDBDEPSPATH)/bacnet-stack-$(BACNET-STACK_VERSION)/include -I$(DCDBDEPSPATH)/bacnet-stack-$(BACNET-STACK_VERSION)/ports/$(BACNET_PORT)
#src/sensors/*/%.o: %.cpp

90
libdcdbplugin_sysfs.$(LIBEXT): src/sensors/sysfs/SysfsSensorGroup.o src/sensors/sysfs/SysfsConfigurator.o
91
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex
92

93
libdcdbplugin_perfevent.$(LIBEXT): src/sensors/perfevent/PerfSensorGroup.o src/sensors/perfevent/PerfeventConfigurator.o
94
95
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system

96
libdcdbplugin_ipmi.$(LIBEXT): src/sensors/ipmi/IPMISensorGroup.o src/sensors/ipmi/IPMIHost.o src/sensors/ipmi/IPMIConfigurator.o
97
98
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lfreeipmi -lboost_regex

99
libdcdbplugin_pdu.$(LIBEXT): src/sensors/pdu/PDUSensorGroup.o src/sensors/pdu/PDUUnit.o src/sensors/pdu/PDUConfigurator.o
100
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lcrypto -lssl -lboost_log -lboost_system
101

102
libdcdbplugin_bacnet.$(LIBEXT): src/sensors/bacnet/BACnetSensorGroup.o src/sensors/bacnet/BACnetClient.o src/sensors/bacnet/BACnetConfigurator.o
103
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lbacnet
104

105
libdcdbplugin_snmp.$(LIBEXT): src/sensors/snmp/SNMPSensorGroup.o src/sensors/snmp/SNMPConnection.o src/sensors/snmp/SNMPConfigurator.o
Micha Mueller's avatar
Micha Mueller committed
106
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lnetsnmp -lnetsnmpagent
Alessio Netti's avatar
Alessio Netti committed
107
108

libdcdbplugin_procfs.$(LIBEXT): src/sensors/procfs/ProcfsSensorGroup.o src/sensors/procfs/ProcfsParser.o src/sensors/procfs/ProcfsConfigurator.o
Alessio Netti's avatar
Alessio Netti committed
109
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex
Alessio Netti's avatar
Alessio Netti committed
110
111
112

libdcdbplugin_tester.$(LIBEXT): src/sensors/tester/TesterSensorGroup.o src/sensors/tester/TesterConfigurator.o
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system
113

lu43jih's avatar
lu43jih committed
114
libdcdbplugin_gpfsmon.$(LIBEXT): src/sensors/gpfsmon/GpfsmonSensorGroup.o src/sensors/gpfsmon/GpfsmonConfigurator.o
lu43jih's avatar
lu43jih committed
115
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system
Carla Guillen Carias's avatar
Carla Guillen Carias committed
116

117
118
#libdcdbplugin_opa.$(LIBEXT): src/sensors/opa/OpaSensorGroup.o src/sensors/opa/OpaConfigurator.o
#	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lopamgt -libverbs -libumad -lssl
119
120
121

libdcdbanalyzer_average.$(LIBEXT): src/analytics/analyzers/average/AverageAnalyzer.o src/analytics/analyzers/average/AverageConfigurator.o src/analytics/SensorNavigator.o
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex