forked from oe5hpm/openBCM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
308 lines (268 loc) · 9.71 KB
/
makefile
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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
#
# Makefile for OpenBCM-Mailbox
HOSTARCH := $(shell uname -m | \
sed -e s/i.86/x86/ \
-e s/sun4u/sparc64/ \
-e s/arm.*/arm/ \
-e s/sa110/arm/ \
-e s/ppc64/powerpc/ \
-e s/ppc/powerpc/ \
-e s/macppc/powerpc/\
-e s/sh.*/sh/)
export HOSTARCH
GPP_VERSION3 := \
$(shell $(CROSS_COMPILE)g++ --version | grep g++ | sed 's/.*g++ (.*) //g' | sed 's/\..*//' | grep 3)
GPP_VERSION33 := \
$(shell $(CROSS_COMPILE)g++-3.3 --version | grep g++ | sed 's/.*g++ (.*) //g' | sed 's/\..*//' | grep 3)
GPP_VERSION4 := \
$(shell $(CROSS_COMPILE)g++ --version | grep g++ | sed 's/.*g++ (.*) //g' | sed 's/\..*//' | grep 4)
ifeq "$(GPP_VERSION33)" "3"
CC = g++-3.3
LD = $(CC)
else
CC = $(CROSS_COMPILE)g++
LD = $(CC)
endif
# ---------------------- armv6 (raspberry) specific ---------------------------
ifeq ($(PLATTFORM), armv6)
ARCHSPEC = -march=armv6zk -mfpu=vfp -mfloat-abi=hard -mcpu=arm1176jzf-s
LFLAGS =
# ---------------------- armv7hf (bur am335x pp) specific ---------------------
else ifeq ($(PLATTFORM), armv7hf)
ARCHSPEC = -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a8
LFLAGS =
# -------------------------- x86 (default) specific ---------------------------
else ifeq ($(HOSTARCH), x86_64)
ARCHSPEC = -m32
LFLAGS = -m32
endif
INC =
LIB =
PROGRAM = bcm
#-----------------------------------------------------------
# uncomment desired options:
LD_OPT = -dynamic $(LFLAGS)
#LD_OPT = -static $(LFLAGS)
# use static option if you compile with other linux as later running
#
# -lm math library is needed for wx-station
#LD_OPT += -lm
#
# Debugging...
#DEBUG = -g -O0
DEBUG = -g
#-----------------------------------------------------------
LD_OPT += -lcrypt
OPT = -O2 -fno-delete-null-pointer-checks -funsigned-char $(ARCHSPEC)
OPT_WARN = -Wcomment -Wno-conversion -Wformat -Wno-unused \
-Wreturn-type -Wno-write-strings -Wuninitialized -Wswitch -Wshadow
ifeq "$(GPP_VERSION4)" "4"
ifeq "$(GPP_VERSION33)" "3"
override OPT = -O2 -fno-delete-null-pointer-checks -funsigned-char -fwritable-strings $(ARCHSPEC)
else
override OPT = -fno-delete-null-pointer-checks -funsigned-char $(ARCHSPEC)
override OPT_WARN = -Wcomment -Wno-conversion -Wformat -Wno-unused -Wreturn-type -Wno-write-strings
endif
endif
# enable following line to see all warnings
#OPT_WARN += -Wall
.SUFFIXES: .cpp .o
DEF_BCM = -DBOXCOMPILE
DEF_L2 = -DL2COMPILE
CFLAGS = $(INC) $(DEBUG) $(OPT) $(OPT_WARN)
BCM_OBJ=ad_linux.o alter.o ax25k.o bcast.o bids.o binsplit.o cfgflex.o charset.o \
check.o cmd.o convers.o convert.o crc.o crontab.o desktop.o didadit.o dir.o \
extract.o fileio.o filesurf.o ftp.o fts.o fwd.o fwd_afwd.o fwd_rli.o fwd_fbb.o \
fwd_file.o grep.o hadr.o http.o help.o huffman.o init.o inout.o interfac.o \
l_flex.o login.o mailserv.o main.o macro.o memalloc.o md2md5.o mdpw.o \
morse.o msg.o nntp.o oldmaili.o ping.o pocsag.o pop3.o purge.o pw.o \
radio.o read.o reorg.o runutils.o sema.o send.o service.o smtp.o socket.o \
sysop.o task.o tell.o terminal.o time.o timerint.o tnc.o trace.o transfer.o \
tree.o tty.o usercomp.o users.o utils.o vidinit.o yapp.o wp.o wx.o \
L2_OBJ= l1main_l.o l1kiss_l.o l1axip_l.o \
l2host.o l2info.o l2interf.o l2main_l.o \
l2mhlist.o l2proto.o l2util.o ax_util.o
VERSION := $(shell grep VNUM mail.h | tr '"' '\n' | grep "1")
VERSION_NO_DOT := $(shell grep VNUM mail.h | tr '"' '\n' | grep "1" | tr -d '.')
SRCDIR = obcm-$(VERSION)
TGZ = s$(SRCDIR).tgz
all: $(PROGRAM)
.cpp.o: $(BCM_OBJ:%.o=%.cpp)
@echo Compiling $<
@$(CC) $(DEF_BCM) $(CFLAGS) -c $<
l1main_l.o: l1main_l.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l1kiss_l.o: l1kiss_l.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l1axip_l.o: l1axip_l.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2host.o: l2host.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2info.o: l2info.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2interf.o: l2interf.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2main_l.o: l2main_l.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2mhlist.o: l2mhlist.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2proto.o: l2proto.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
l2util.o: l2util.cpp
@echo Compiling $<
@$(CC) $(DEF_L2) $(CFLAGS) -c $<
prepare:
ifeq "$(GPP_VERSION3)" "3"
@echo "Usage of GCC 3.x compiler..."
else
ifeq "$(GPP_VERSION4)" "4"
ifeq "$(GPP_VERSION33)" "3"
@echo "Usage of GCC 3.3 compiler..."
else
@echo "Usage of GCC 4.x compiler..."
endif
endif
endif
$(PROGRAM): prepare $(L2_OBJ) $(BCM_OBJ)
@echo Linking OpenBCM version $(VERSION)...
$(LD) -o $(PROGRAM) $(L2_OBJ) $(BCM_OBJ) $(LD_OPT)
$(CROSS_COMPILE)strip $(PROGRAM)
lib: libbcm.a
libbcm.a: $(L2_OBJ) $(BCM_OBJ)
@echo Creating libbcm.a ...
@ar r libbcm.a $(L2_OBJ) $(BCM_OBJ)
clean:
@echo Removing obsolete files ...
rm -f *.o *.obj *~ *.bak *.sym *.ncb *.plg *.rej *.orig $(PROGRAM)
install: all
@echo Making backup of old version as ../../bcm.old
@echo copying new bcm to ../../obcm-$(VERSION)
@echo and installing ../../obcm-$(VERSION) as ../../bcm
@mv -f ../../bcm ../../bcm.old
@cp -fa bcm ../../obcm-$(VERSION)
@cp -fa bcm ../../bcm
rpminstall: all
@echo Making backup of old version as ../../bcm.old
@echo copying new bcm to ../../obcm-$(VERSION)
@echo and installing ../../obcm-$(VERSION) as ../../bcm
@mv -f /bcm/bcm /bcm/bcm.old
@cp -fa bcm /bcm/obcm-$(VERSION)
@ln -s /bcm/obcm-$(VERSION) /bcm/bcm
new: clean all
rpm:
@echo "# spec file for package obcm" > obcm.spec
@echo "#" >> obcm.spec
@echo "# Copyright (c) 2013 DH8YMB Markus Baumann, Lippstadt, Germany" >> obcm.spec
@echo " " >> obcm.spec
@echo "Summary: OpenBCM Packet Radio BBS" >> obcm.spec
@echo "Name: obcm" >> obcm.spec
@echo "Version: $(VERSION)" >> obcm.spec
@echo "Release: 1" >> obcm.spec
@echo "License: GPL" >> obcm.spec
@echo "Group: unsorted" >> obcm.spec
@echo "URL: http://dnx274.org/baybox" >> obcm.spec
@echo "Source: sobcm-%{version}.tgz" >> obcm.spec
@echo "BuildRoot: /var/tmp/%{name}-%{version}-root" >> obcm.spec
@echo "Distribution: none" >> obcm.spec
@echo "Vendor: Markus Baumann, DH8YMB, Lippstadt, Germany" >> obcm.spec
@echo "Packager: Markus Baumann DH8YMB <dh8ymb(at)web.de>" >> obcm.spec
@echo " " >> obcm.spec
@echo "%description" >> obcm.spec
@echo "OpenBCM is a full featured AX.25 packet radio mailbox for use" >> obcm.spec
@echo "in ham radio as well as in citizen band with full store and forward" >> obcm.spec
@echo "capabilities. It offers also a lot of TCP/IP services like HTTP," >> obcm.spec
@echo "NNTP, POP3, SMTP and TELNET. The software is available for Linux," >> obcm.spec
@echo "DOS and Windows NT/2000/XP." >> obcm.spec
@echo " " >> obcm.spec
@echo "Authors:" >> obcm.spec
@echo " Markus Baumann, DH8YMB" >> obcm.spec
@echo " Dietmar Zlabinger, OE3DZW" >> obcm.spec
@echo " Florian Radlheer, DL8MBT" >> obcm.spec
@echo " Johann Hanne, DH3MB" >> obcm.spec
@echo " Patrick Sesseler, DF3VI" >> obcm.spec
@echo " et al." >> obcm.spec
@echo " " >> obcm.spec
@echo "%prep" >> obcm.spec
@echo " " >> obcm.spec
@echo "%setup" >> obcm.spec
@echo " " >> obcm.spec
@echo "%build" >> obcm.spec
@echo "make" >> obcm.spec
@echo " " >> obcm.spec
@echo "%install" >> obcm.spec
@echo "make rpminstall" >> obcm.spec
@echo "rm -f %{buildroot}/bcm/bcm" >> obcm.spec
@echo "mkdir -p %{buildroot}/bcm" >> obcm.spec
@echo "mkdir -p %{buildroot}/bcm/msg" >> obcm.spec
@echo "cp -f changes.txt %{buildroot}/bcm" >> obcm.spec
@echo "cp -f /bcm/startbcm %{buildroot}/bcm" >> obcm.spec
@echo "cp -f /bcm/msg/help.dl %{buildroot}/bcm/msg" >> obcm.spec
@echo "cp -f /bcm/msg/help.gb %{buildroot}/bcm/msg" >> obcm.spec
@echo "cp -f bcm %{buildroot}/bcm" >> obcm.spec
@echo " " >> obcm.spec
@echo "%clean" >> obcm.spec
@echo "rm -f /bcm/bcm" >> obcm.spec
@echo "rm -f /bcm/changes.txt" >> obcm.spec
@echo " " >> obcm.spec
@echo "%files" >> obcm.spec
@echo "/bcm/bcm" >> obcm.spec
@echo "/bcm/startbcm" >> obcm.spec
@echo "/bcm/changes.txt" >> obcm.spec
@echo "/bcm/msg/help.dl" >> obcm.spec
@echo "/bcm/msg/help.gb" >> obcm.spec
@echo " " >> obcm.spec
@echo Setting up modes ...
@chmod a-x `find . -type f`
@echo Copying files ...
@rm -rf $(SRCDIR)
@mkdir $(SRCDIR)
@cp -a `find . -type f` $(SRCDIR)
@echo Preparing files for archive ...
@rm -f $(SRCDIR)/*.tgz $(SRCDIR)/*.zip $(SRCDIR)/*.o $(SRCDIR)/*~ \
$(SRCDIR)/*.bak $(SRCDIR)/*.sym $(SRCDIR)/*.ncb \
$(SRCDIR)/*.plg $(SRCDIR)/$(PROGRAM) $(SRCDIR)/*.orig \
$(SRCDIR)/*.rej $(SRCDIR)/*.md5
@md5sum -b *.cpp *.h > $(SRCDIR)/$(SRCDIR).md5
@touch $(SRCDIR)/*
@echo Creating $(TGZ) ...
@tar zcf $(TGZ) $(SRCDIR)
@rm -rf $(SRCDIR)
@echo Creating RPM-File
@cp *.tgz /usr/src/packages/SOURCES
@rpmbuild -ba obcm.spec
@rm -f obcm.spec
@cp /usr/src/packages/BUILD/obcm-$(VERSION)/bcm /bcm/obcm-$(VERSION)
@ln -s /bcm/obcm-$(VERSION) /bcm/bcm
distribute: rpm
@cp *.tgz /http/htdocs/baybox/pre
@cp changes.txt /http/htdocs/baybox/pre
@cp /usr/src/packages/SRPMS/obcm-$(VERSION)-1.src.rpm /http/htdocs/baybox/pre
@cp /usr/src/packages/RPMS/i586/obcm-$(VERSION)-1.i586.rpm /http/htdocs/baybox/pre/obcm-$(VERSION)-1.i586_OpenSuse_11.2.rpm
tgz: $(TGZ)
$(TGZ):
@echo Setting up modes ...
@chmod a-x `find . -type f`
@echo Copying files ...
@rm -rf $(SRCDIR)
@mkdir $(SRCDIR)
@cp -a `find . -type f` $(SRCDIR)
@echo Preparing files for archive ...
@rm -f $(SRCDIR)/*.tgz $(SRCDIR)/*.zip $(SRCDIR)/*.o $(SRCDIR)/*~ \
$(SRCDIR)/*.bak $(SRCDIR)/*.sym $(SRCDIR)/*.ncb \
$(SRCDIR)/*.plg $(SRCDIR)/$(PROGRAM) $(SRCDIR)/*.orig \
$(SRCDIR)/*.rej $(SRCDIR)/*.md5
@md5sum -b *.cpp *.h > $(SRCDIR)/$(SRCDIR).md5
@touch $(SRCDIR)/*
@echo Creating $(TGZ) ...
@tar zcf $(TGZ) $(SRCDIR)
@rm -rf $(SRCDIR)
# DO NOT DELETE THIS LINE -- make depend depends on it.