summaryrefslogtreecommitdiff
path: root/application/agent/Makefile
blob: cb84e0591f0b8ac730487e46729414849593f80f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#-------------------------#
# Makefile for SNMP agent #
# ***** LINUX Polux ***** #
# ====< arm-uclinux >==== #
#       ( sm-agent )      #
#-------------------------#
#  by Alexandre Poullain  #
# "Spidcom  Technologies" #
#   Date : 26 May 2005    #
#-------------------------#

# To test with the underlayer stub, launch the makefile with TEST=1

TOPDIR=../..
LINUX_DIR=$(TOPDIR)/linux-2.6.10
APP_DIR=$(TOPDIR)/application

-include $(TOPDIR)/.config

OBJ = agent_remote_log.o
OBJ += agent.o
OBJ += AlarmList.o
OBJ += AlarmListManager.o
OBJ += AlarmObjectModel.o
OBJ += autoinccounter.o
OBJ += ConfigurationManager.o
ifeq ($(BR2_TRAP_SUPPORT),y)
OBJ += eventListener.o
OBJ += eventListenerNetlinkSocket.o
OBJ += eventListenerTcpSocket.o
OBJ += trapBuilder.o
endif
OBJ += processManager.o
OBJ += sm_agent_log_entry.o
OBJ += systemmanager.o
OBJ += SystemManagerSarft.o
OBJ += underlayer.o
OBJ += UnderlayerSarft.o

OBJS=$(addprefix $(OBJDIR)/,$(OBJ))

AGENTGEN_OBJDIR = $(OBJDIR)/agentgen

ifeq ($(BR2_SARFT_MIB_ALARM),y)
AGENTGEN_OBJ += nscrtv_eponeoc_alarms_mib.o
endif
ifeq ($(BR2_SARFT_MIB_COMMON),y)
AGENTGEN_OBJ += nscrtv_eponeoc_common_mib.o
endif
ifeq ($(BR2_SARFT_MIB_PROPERTY),y)
AGENTGEN_OBJ += nscrtv_eponeoc_property_mib.o
endif
AGENTGEN_OBJ += nscrtv_root.o
AGENTGEN_OBJ += snmpv2_conf.o
AGENTGEN_OBJ += snmpv2_smi.o
AGENTGEN_OBJ += snmpv2_tc.o
ifeq ($(BR2_IF_MIB),y)
	AGENTGEN_OBJ += if_mib.o
endif
ifeq ($(BR2_IP_MIB),y)
	AGENTGEN_OBJ += ip_mib.o
endif
ifeq ($(BR2_MAU_MIB),y)
	AGENTGEN_OBJ += mau_mib.o
endif
ifeq ($(BR2_SPC200_MIB),y)
	AGENTGEN_OBJ += spc200.o
endif
ifeq ($(BR2_TRAP_SUPPORT),y)
AGENTGEN_OBJ += spidcom_alarm_mib.o
AGENTGEN_OBJ += spidcom_traps.o
endif
ifeq ($(BR2_SPIDCOM_EOC_MIB),y)
	AGENTGEN_OBJ += nscrtv_eponeoc_mod_eoc_mib.o
endif

AGENTGEN_OBJS=$(addprefix $(AGENTGEN_OBJDIR)/,$(AGENTGEN_OBJ))

#Previous MIBs removed
#AGENTGEN_OBJ = alarm_mib.o
#AGENTGEN_OBJ += general_mib.o
#AGENTGEN_OBJ += property_mib.o
#AGENTGEN_OBJ += sarft_mib.o
#AGENTGEN_OBJ += bridge_mib.o
#AGENTGEN_OBJ += ne_alarm_mib.o
#AGENTGEN_OBJ += radius_auth_client_mib.o
#AGENTGEN_OBJ += rfc1213_mib.o
#AGENTGEN_OBJ += spidcom_mib.o
#AGENTGEN_OBJ += spidcom_notification_mib.o


AGENT_OBJDIR = $(OBJDIR)/agent++
AGENT_OBJ = avl_map.o
AGENT_OBJ += map.o
AGENT_OBJ += mib_context.o
AGENT_OBJ += mib_entry.o
AGENT_OBJ += mib.o
AGENT_OBJ += notification_originator.o
AGENT_OBJ += request.o
AGENT_OBJ += snmp_counters.o
AGENT_OBJ += snmp_group.o
AGENT_OBJ += snmp_notification_mib.o
AGENT_OBJ += snmp_pp_ext.o
AGENT_OBJ += snmp_request.o
AGENT_OBJ += snmp_target_mib.o
AGENT_OBJ += snmp_textual_conventions.o
AGENT_OBJ += system_group.o
AGENT_OBJ += threads.o
AGENT_OBJ += tools.o

AGENT_OBJS=$(addprefix $(AGENT_OBJDIR)/,$(AGENT_OBJ))

#Previous agent objects removed
#AGENT_OBJ += sim_mib.o
#AGENT_OBJ += mib_avl_map.o
#AGENT_OBJ += vacm.o
#AGENT_OBJ += mib_proxy.o
#AGENT_OBJ += mib_map.o
#AGENT_OBJ += snmp_proxy_mib.o


SNMP_OBJDIR = $(OBJDIR)/snmp++
SNMP_OBJ = address.o
SNMP_OBJ += asn1.o
SNMP_OBJ += collect.o
SNMP_OBJ += counter.o
SNMP_OBJ += ctr64.o
SNMP_OBJ += eventlist.o
SNMP_OBJ += eventlistholder.o
SNMP_OBJ += gauge.o
SNMP_OBJ += integer.o
SNMP_OBJ += log.o
SNMP_OBJ += msec.o
SNMP_OBJ += msgqueue.o
SNMP_OBJ += notifyqueue.o
SNMP_OBJ += octet.o
SNMP_OBJ += oid.o
SNMP_OBJ += pdu.o
SNMP_OBJ += reentrant.o
SNMP_OBJ += snmpmsg.o
SNMP_OBJ += target.o
SNMP_OBJ += timetick.o
SNMP_OBJ += uxsnmp.o
SNMP_OBJ += vb.o

SNMP_OBJS=$(addprefix $(SNMP_OBJDIR)/,$(SNMP_OBJ))

STUB_TEST_OBJDIR = $(OBJDIR)/stub_test
STUB_TEST_OBJ =
ifdef TEST
	STUB_TEST_OBJ = $(STUB_TEST_OBJDIR)/Stub.o
endif

ALL_OBJS = $(SNMP_OBJS) $(AGENT_OBJS) $(AGENTGEN_OBJS) $(STUB_TEST_OBJ) $(OBJS)

VPATH=$(SNMP_SRCDIR) $(AGENT_SRCDIR) $(AGENTGEN_SRCDIR) $(STUB_TEST_SRCDIR) $(SRCDIR)

#************************************************************

SNMP_AGENT=snmp_agent

GCCTARGET=arm-uclinux
CC=arm-uclinux-g++
AR=arm-uclinux-ar

INCDIR=inc
AGENTGEN_INCDIR=agent++/agentgen/agent/include
AGENT_INCDIR=agent++/include
SNMP_INCDIR=snmp++/include
STUB_TEST_INCDIR=test/stub/inc
INCLUDE=-Iinc -I$(LINUX_DIR)/include -I$(APP_DIR)/mib/inc -I$(APP_DIR)/custom-mib/inc -I$(TOPDIR)/include -I$(TOPDIR)/include/plc-drv -I$(APP_DIR)/spidlib/inc -I$(APP_DIR)/spidlib/interface -I$(APP_DIR)/smm/smm-client/inc -I$(APP_DIR)/boottable/inc -I$(SNMP_INCDIR) -I$(AGENT_INCDIR) -I$(AGENTGEN_INCDIR)

ifdef TEST
	INCLUDE += -I$(STUB_TEST_INCDIR)
endif

CFLAGS = $(DEFINES) $(INCLUDE) -c -msoft-float -march=armv5 -mtune=arm926ejs -mapcs-32 -O2 -fno-rtti -fno-access-control -fno-exceptions
LDFLAGS = -msoft-float -march=armv5 -Wl,-elf2flt='-z -s 32k'

DEFINES = -DFEATURE_AGENT -D_NO_THREADS -D__LINUX__ -D_NO_LOGGING -DNO_LOG_AGENT
# Do not use -D_NO_SNMPv3 (there is a bug in snmp++ => define it in snmp++/include/snmp_pp/config_snmp_pp.h)
#-DREMOTE_LOG (remove -fno-rtti to use this one on the board)
ifdef TEST
	DEFINES += -DSTUB_TEST
endif
ifeq ($(BR2_SARFT_MIB_ALARM),y)
DEFINES += -DSARFT_MIB_ALARM
endif
ifeq ($(BR2_SARFT_MIB_COMMON),y)
DEFINES += -DSARFT_MIB_COMMON
endif
ifeq ($(BR2_SARFT_MIB_PROPERTY),y)
DEFINES += -DSARFT_MIB_PROPERTY
endif
ifeq ($(BR2_SPC200_MIB),y)
DEFINES += -DSPC200_MIB
endif
ifeq ($(BR2_IF_MIB),y)
DEFINES += -DIF_MIB
endif
ifeq ($(BR2_IP_MIB),y)
DEFINES += -DIP_MIB
endif
ifeq ($(BR2_MAU_MIB),y)
DEFINES += -DMAU_MIB
endif
ifeq ($(BR2_SYSGROUP_MIB),y)
DEFINES += -DSYSGROUP_MIB
endif
ifeq ($(BR2_TRAP_SUPPORT),y)
DEFINES += -DTRAP_SUPPORT
endif
ifeq ($(BR2_SPIDCOM_EOC_MIB),y)
DEFINES += -DSPIDCOM_EOC_MIB
endif


OBJPARENT=obj
OBJDIR=$(OBJPARENT)/$(GCCTARGET)

SRCDIR=src
AGENTGEN_SRCDIR=agent++/agentgen/agent/src
AGENT_SRCDIR=agent++/src
SNMP_SRCDIR=snmp++/src
STUB_TEST_SRCDIR=test/stub/src

#************************************************************

all: $(SNMP_AGENT)

$(SNMP_AGENT): $(OBJDIR) $(SNMP_OBJDIR) $(AGENT_OBJDIR) $(AGENTGEN_OBJDIR) $(STUB_TEST_OBJDIR) $(ALL_OBJS) $(APP_DIR)/boottable/boottable.a \
	$(APP_DIR)/spidlib/spidlib.a $(APP_DIR)/mib/mib.a $(APP_DIR)/custom-mib/custom-mib.a $(APP_DIR)/smm/smm-client/smmlib.a
	$(CC) -o $@ $(ALL_OBJS) $(APP_DIR)/mib/mib.a $(APP_DIR)/custom-mib/custom-mib.a $(APP_DIR)/smm/smm-client/smmlib.a $(LDFLAGS) -lpthread $(APP_DIR)/boottable/boottable.a $(APP_DIR)/spidlib/spidlib.a

$(OBJPARENT) :
	mkdir $(OBJPARENT)

$(OBJDIR) : $(OBJPARENT)
	mkdir $(OBJDIR)

$(SNMP_OBJDIR) : $(OBJPARENT)
	mkdir $(SNMP_OBJDIR)

$(AGENT_OBJDIR) : $(OBJPARENT)
	mkdir $(AGENT_OBJDIR)

$(AGENTGEN_OBJDIR) : $(OBJPARENT)
	mkdir $(AGENTGEN_OBJDIR)

$(STUB_TEST_OBJDIR) : $(OBJPARENT)
	mkdir $(STUB_TEST_OBJDIR)

$(SNMP_OBJDIR)/%.o : %.cpp
	$(CC) -MMD $(CFLAGS) -o $@ $<

-include $(SNMP_OBJDIR)/*.d

$(AGENT_OBJDIR)/%.o : %.cpp
	$(CC) -MMD $(CFLAGS) -o $@ $<

-include $(AGENT_OBJDIR)/*.d

$(AGENTGEN_OBJDIR)/%.o : %.cpp
	$(CC) -MMD $(CFLAGS) -o $@ $<

-include $(AGENTGEN_OBJDIR)/*.d

$(STUB_TEST_OBJDIR)/%.o : %.cpp
	$(CC) -MMD $(CFLAGS) -o $@ $<

-include $(STUB_TEST_OBJDIR)/*.d

$(OBJDIR)/%.o : %.cpp
	$(CC) -MMD $(CFLAGS) -o $@ $<

-include $(OBJDIR)/*.d


BOARD_SHARE_DIR	= /etc/init.d
START_SCRIPT = scripts/agent_start

copy: $(TARGET) $(START_SCRIPT)
	cp $(TARGET) $(BOARD_SHARE_DIR)
	cp $(START_SCRIPT) $(BOARD_SHARE_DIR)
	chmod 755 $(BOARD_SHARE_DIR)/$(START_SCRIPT)

clean :
	rm -rf $(SNMP_OBJDIR)
	rm -rf $(AGENT_OBJDIR)
	rm -rf $(AGENTGEN_OBJDIR)
	rm -rf $(STUB_TEST_OBJDIR)
	rm -rf $(OBJDIR)
	rm -rf $(OBJPARENT)