2.12.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Makefile 5.07 KB
Newer Older
1
2
include ../config.mk

3
CXXFLAGS += -DBOOST_NETWORK_ENABLE_HTTPS \
4
           -I../common/include \
5
           -I$(DCDBDEPLOYPATH)/include
6
7
8
9

ifneq (,$(wildcard /usr/include/opamgt))
	CXXFLAGS += -I/usr/include/opamgt
endif
10
           
11
LIBS = -L$(DCDBDEPLOYPATH)/lib/ \
12
13
14
15
       -ldl \
       -lmosquitto \
       -lboost_system \
       -lboost_thread \
Micha Mueller's avatar
Micha Mueller committed
16
       -lboost_filesystem \
17
18
19
20
21
22
23
24
25
26
27
       -lboost_log_setup \
       -lboost_log \
       -lboost_regex \
       -lpthread \
       -lcrypto \
       -lssl \
       -rdynamic
       
OBJS = dcdbpusher.o \
       Configuration.o \
       MQTTPusher.o \
28
       RestAPI.o \
29
       PluginManager.o \
30
       ../analytics/OperatorManager.o \
31
       ../common/src/sensornavigator.o \
32
       ../common/src/globalconfiguration.o \
33
       ../common/src/logging.o \
34
       ../common/src/RESTHttpsServer.o
35
36
37
38
39
40

TARGET = dcdbpusher

ifeq ($(OS),Darwin)
	BACNET_PORT = bsd
	LIBEXT = dylib
41
	LIBFLAGS = -dynamiclib -install_name 
42
else
43
	LIBS+= -Wl,-rpath-link=$(DCDBDEPLOYPATH)/lib/
44
45
46
47
48
49
50
	BACNET_PORT = linux
	LIBEXT = so
	LIBFLAGS = -shared -Wl,-soname,
	PLUGINFLAGS = -fPIC
endif
PLUGIN_LIBS = $(foreach p,$(PLUGINS),libdcdbplugin_$(p).$(LIBEXT))

51
52
all:	$(TARGET) $(PLUGIN_LIBS)

53
54
55
56
57
58
$(TARGET): $(foreach f,$(DISTFILESPATHS),$(DCDBDEPSPATH)/$(f)/.installed) $(OBJS)
	$(CXX) -o $(TARGET) $(OBJS) $(LIBS)

debug: CXXFLAGS += -DDEBUG
debug: all

59
60
61
info:
	@echo $(PLUGINS) $(PLUGIN_LIBS)

62
clean:
63
	rm -f $(PLUGIN_LIBS) $(TARGET) $(OBJS) $(foreach p,$(PLUGINS),sensors/$(p)/*.o)
64
65
66
67
68
69

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

install_lib: $(PLUGIN_LIBS)
	install $^ $(DCDBDEPLOYPATH)/lib/

Micha Müller's avatar
Micha Müller committed
70
install_conf: $(foreach p,dcdbpusher $(PLUGINS),config/$(p).conf)
71
72
	install -m 644 $^ $(DCDBDEPLOYPATH)/etc/

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

BACNET_SRC:= $(shell find $(DCDBDEPSPATH) -name "bacnet-stack-*" -type d)
sensors/%.o: CXXFLAGS+= $(PLUGINFLAGS)
sensors/bacnet/%.o: CXXFLAGS+= -I$(BACNET_SRC)/include -I$(BACNET_SRC)/ports/$(BACNET_PORT)
Alessio Netti's avatar
Alessio Netti committed
83
../common/src/sensornavigator.o: CXXFLAGS+= $(PLUGINFLAGS)
84
85
86
87
88

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

libdcdbplugin_perfevent.$(LIBEXT): sensors/perfevent/PerfSensorGroup.o sensors/perfevent/PerfeventConfigurator.o
89
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system
90

91
libdcdbplugin_ipmi.$(LIBEXT): sensors/ipmi/IPMISensorGroup.o sensors/ipmi/IPMIHost.o sensors/ipmi/IPMIConfigurator.o sensors/ipmi/LenovoXCC.o
92
93
94
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex -lfreeipmi

libdcdbplugin_pdu.$(LIBEXT): sensors/pdu/PDUSensorGroup.o sensors/pdu/PDUUnit.o sensors/pdu/PDUConfigurator.o
95
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lcrypto -lssl -lboost_log -lboost_system
96
97

libdcdbplugin_bacnet.$(LIBEXT): sensors/bacnet/BACnetSensorGroup.o sensors/bacnet/BACnetClient.o sensors/bacnet/BACnetConfigurator.o
98
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lbacnet
99
100

libdcdbplugin_snmp.$(LIBEXT): sensors/snmp/SNMPSensorGroup.o sensors/snmp/SNMPConnection.o sensors/snmp/SNMPConfigurator.o
101
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lnetsnmp -lnetsnmpagent
102
103
104
105
106

libdcdbplugin_procfs.$(LIBEXT): sensors/procfs/ProcfsSensorGroup.o sensors/procfs/ProcfsParser.o sensors/procfs/ProcfsConfigurator.o
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lboost_regex

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

libdcdbplugin_gpfsmon.$(LIBEXT): sensors/gpfsmon/GpfsmonSensorGroup.o sensors/gpfsmon/GpfsmonConfigurator.o
110
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system
111

112
113
libdcdbplugin_opa.$(LIBEXT): sensors/opa/OpaSensorGroup.o sensors/opa/OpaConfigurator.o
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lopamgt -lssl
114

115
116
117
libdcdbplugin_msr.$(LIBEXT): sensors/msr/MSRSensorGroup.o sensors/msr/MSRConfigurator.o
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system

118
libdcdbplugin_caliper.$(LIBEXT): sensors/caliper/CaliperSensorGroup.o sensors/caliper/CaliperConfigurator.o
119
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system
120
121
122
123
# nvcc compiler and extra flags to enable the linking and creating of .so file to work: 
 libdcdbplugin_nvml.$(LIBEXT): sensors/nvml/nvmlSensorGroup.o sensors/nvml/nvmlConfigurator.o
	$(NVCC) -shared --compiler-options '-fPIC'  -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lboost_log -lboost_system -lnvidia-ml

124
libdcdbplugin_rest.$(LIBEXT): sensors/rest/RESTSensorGroup.o sensors/rest/RESTUnit.o sensors/rest/RESTConfigurator.o
125
	$(CXX) $(LIBFLAGS)$@ -o $@ $^ -L$(DCDBDEPLOYPATH)/lib/ -lcrypto -lssl -lboost_regex -lboost_log -lboost_system
126
127