Skip to content

Commit 5897b0e

Browse files
committedAug 22, 2021
WIP. Reorganize src build directories
1 parent ce2be7c commit 5897b0e

40 files changed

+115
-132
lines changed
 

‎Makefile

+87-119
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ endif
2727
HAVE_IPV6 ?= yes
2828
export HAVE_IPV6
2929

30+
# directories
31+
INCDIR = include
32+
SRCDIR = src
33+
BUILD = build
34+
3035
CC ?= gcc
3136
#AR = gar
3237
#CFLAGS = -O -g
@@ -39,6 +44,7 @@ CFLAGS ?= -O
3944
CFLAGS += -Wall
4045
CFLAGS += -W -Wstrict-prototypes
4146
CFLAGS += -fno-common
47+
CPPFLAGS += -I$(BUILD)
4248
CPPFLAGS += -DMINIUPNPC_SET_SOCKET_TIMEOUT
4349
CPPFLAGS += -DMINIUPNPC_GET_SRC_ADDR
4450
CPPFLAGS += -D_BSD_SOURCE
@@ -53,6 +59,9 @@ endif
5359
#CFLAGS += -ansi
5460
#CPPFLAGS += -DNO_GETADDRINFO
5561

62+
DEPFLAGS = -MM -MG
63+
64+
MKDIR = mkdir -p
5665
INSTALL = install
5766
SH = /bin/sh
5867
JAVA = java
@@ -77,72 +86,65 @@ endif
7786
# APIVERSION is used to build SONAME
7887
APIVERSION = 17
7988

80-
SRCS = igd_desc_parse.c miniupnpc.c minixml.c minisoap.c miniwget.c \
81-
upnpc.c upnpcommands.c upnpreplyparse.c testminixml.c \
82-
minixmlvalid.c testupnpreplyparse.c minissdpc.c \
83-
upnperrors.c testigddescparse.c testminiwget.c \
84-
connecthostport.c portlistingparse.c receivedata.c \
85-
upnpdev.c testportlistingparse.c miniupnpcmodule.c \
86-
minihttptestserver.c addr_is_reserved.c testaddr_is_reserved.c \
87-
listdevices.c
89+
SRCS = $(wildcard $(SRCDIR)/*.c)
8890

89-
LIBOBJS = miniwget.o minixml.o igd_desc_parse.o minisoap.o \
91+
LIBOBJS = $(addprefix $(BUILD)/,miniwget.o minixml.o igd_desc_parse.o minisoap.o \
9092
miniupnpc.o upnpreplyparse.o upnpcommands.o upnperrors.o \
9193
connecthostport.o portlistingparse.o receivedata.o upnpdev.o \
92-
addr_is_reserved.o
94+
addr_is_reserved.o)
9395

94-
ifeq (, $(findstring amiga, $(OS)))
95-
ifeq (, $(findstring mingw, $(OS))$(findstring cygwin, $(OS))$(findstring msys, $(OS)))
96-
CFLAGS := -fPIC $(CFLAGS)
97-
endif
98-
LIBOBJS := $(LIBOBJS) minissdpc.o
99-
endif
96+
BUILDINCLUDES = $(addprefix $(BUILD)/, miniupnpcstrings.h)
10097

101-
OBJS = $(patsubst %.c,%.o,$(SRCS))
98+
OBJS = $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.o,$(SRCS))
99+
DEPS = $(patsubst $(SRCDIR)/%.c,$(BUILD)/%.d,$(SRCS))
102100

103101
# HEADERS to install
104-
CPPFLAGS += -Iinclude/
105-
HEADERS = $(wildcard include/*.h)
102+
CPPFLAGS += -I$(INCDIR)
103+
HEADERS = $(wildcard $(INCDIR)/*.h)
106104

107105
# library names
108-
LIBRARY = libminiupnpc.a
106+
LIBRARY = $(BUILD)/libminiupnpc.a
109107
ifneq (, $(findstring darwin, $(OS)))
110-
SHAREDLIBRARY = libminiupnpc.dylib
111-
SONAME = $(basename $(SHAREDLIBRARY)).$(APIVERSION).dylib
108+
SHAREDLIBRARY = $(BUILD)/libminiupnpc.dylib
109+
SONAME = $(notdir $(basename $(SHAREDLIBRARY))).$(APIVERSION).dylib
112110
CPPFLAGS += -D_DARWIN_C_SOURCE
113111
else
114112
ifeq ($(JARSUFFIX), win32)
115-
SHAREDLIBRARY = miniupnpc.dll
113+
SHAREDLIBRARY = $(BUILD)/miniupnpc.dll
116114
else
117115
# Linux/BSD/etc.
118-
SHAREDLIBRARY = libminiupnpc.so
119-
SONAME = $(SHAREDLIBRARY).$(APIVERSION)
116+
SHAREDLIBRARY = $(BUILD)/libminiupnpc.so
117+
SONAME = $(notdir $(SHAREDLIBRARY)).$(APIVERSION)
120118
endif
121119
endif
122120

123-
EXECUTABLES = upnpc-static listdevices
124-
EXECUTABLES_ADDTESTS = testminixml minixmlvalid testupnpreplyparse \
125-
testigddescparse testminiwget testportlistingparse
121+
EXECUTABLES = $(addprefix $(BUILD)/, upnpc-static listdevices)
122+
EXECUTABLES_ADDTESTS = $(addprefix $(BUILD)/, testminixml minixmlvalid \
123+
testupnpreplyparse testigddescparse testminiwget testportlistingparse)
126124

127-
TESTMINIXMLOBJS = minixml.o igd_desc_parse.o testminixml.o
125+
TESTMINIXMLOBJS = $(addprefix $(BUILD)/, minixml.o igd_desc_parse.o testminixml.o)
128126

129-
TESTMINIWGETOBJS = miniwget.o testminiwget.o connecthostport.o receivedata.o
127+
TESTMINIWGETOBJS = $(addprefix $(BUILD)/, miniwget.o testminiwget.o connecthostport.o receivedata.o)
130128

131-
TESTUPNPREPLYPARSE = testupnpreplyparse.o minixml.o upnpreplyparse.o
129+
TESTUPNPREPLYPARSE = $(addprefix $(BUILD)/, testupnpreplyparse.o minixml.o upnpreplyparse.o)
132130

133-
TESTPORTLISTINGPARSE = testportlistingparse.o minixml.o portlistingparse.o
131+
TESTPORTLISTINGPARSE = $(addprefix $(BUILD)/, testportlistingparse.o minixml.o portlistingparse.o)
134132

135-
TESTADDR_IS_RESERVED = testaddr_is_reserved.o addr_is_reserved.o
133+
TESTADDR_IS_RESERVED = $(addprefix $(BUILD)/, testaddr_is_reserved.o addr_is_reserved.o)
136134

137-
TESTIGDDESCPARSE = testigddescparse.o igd_desc_parse.o minixml.o \
135+
TESTIGDDESCPARSE = $(addprefix $(BUILD)/, testigddescparse.o igd_desc_parse.o minixml.o \
138136
miniupnpc.o miniwget.o upnpcommands.o upnpreplyparse.o \
139137
minisoap.o connecthostport.o receivedata.o \
140-
portlistingparse.o addr_is_reserved.o
138+
portlistingparse.o addr_is_reserved.o)
141139

142140
ifeq (, $(findstring amiga, $(OS)))
143-
EXECUTABLES := $(EXECUTABLES) upnpc-shared
144-
TESTMINIWGETOBJS := $(TESTMINIWGETOBJS) minissdpc.o
145-
TESTIGDDESCPARSE := $(TESTIGDDESCPARSE) minissdpc.o
141+
ifeq (, $(findstring mingw, $(OS))$(findstring cygwin, $(OS))$(findstring msys, $(OS)))
142+
CFLAGS += -fPIC
143+
endif
144+
EXECUTABLES += $(BUILD)/upnpc-shared
145+
TESTMINIWGETOBJS += $(BUILD)/minissdpc.o
146+
TESTIGDDESCPARSE += $(BUILD)/minissdpc.o
147+
LIBOBJS += $(BUILD)/minissdpc.o
146148
endif
147149

148150
LIBDIR ?= lib
@@ -160,13 +162,12 @@ PKGCONFIGDIR = $(INSTALLDIRLIB)/pkgconfig
160162

161163
FILESTOINSTALL = $(LIBRARY) $(EXECUTABLES)
162164
ifeq (, $(findstring amiga, $(OS)))
163-
FILESTOINSTALL := $(FILESTOINSTALL) $(SHAREDLIBRARY) miniupnpc.pc
165+
FILESTOINSTALL += $(SHAREDLIBRARY) miniupnpc.pc
164166
endif
165167

166168

167169
.PHONY: install clean depend all check test everything \
168170
installpythonmodule updateversion
169-
# validateminixml validateminiwget
170171

171172
all: $(LIBRARY) $(EXECUTABLES)
172173

@@ -177,53 +178,53 @@ check: validateminixml validateminiwget validateupnpreplyparse \
177178

178179
everything: all $(EXECUTABLES_ADDTESTS)
179180

180-
pythonmodule: $(LIBRARY) miniupnpcmodule.c setup.py
181+
pythonmodule: $(LIBRARY) $(SRCDIR)/miniupnpcmodule.c setup.py
181182
MAKE=$(MAKE) python setup.py build
182183
touch $@
183184

184185
installpythonmodule: pythonmodule
185186
MAKE=$(MAKE) python setup.py install
186187

187-
pythonmodule3: $(LIBRARY) miniupnpcmodule.c setup.py
188+
pythonmodule3: $(LIBRARY) $(SRCDIR)/miniupnpcmodule.c setup.py
188189
MAKE=$(MAKE) python3 setup.py build
189190
touch $@
190191

191192
installpythonmodule3: pythonmodule3
192193
MAKE=$(MAKE) python3 setup.py install
193194

194-
validateminixml: minixmlvalid
195+
validateminixml: $(BUILD)/minixmlvalid
195196
@echo "minixml validation test"
196-
./minixmlvalid
197+
./$<
197198
touch $@
198199

199-
validateminiwget: testminiwget minihttptestserver testminiwget.sh
200+
validateminiwget: testminiwget.sh $(BUILD)/testminiwget $(BUILD)/minihttptestserver
200201
@echo "miniwget validation test"
201-
./testminiwget.sh
202+
./$<
202203
touch $@
203204

204-
validateupnpreplyparse: testupnpreplyparse testupnpreplyparse.sh
205+
validateupnpreplyparse: testupnpreplyparse.sh $(BUILD)/testupnpreplyparse
205206
@echo "upnpreplyparse validation test"
206-
./testupnpreplyparse.sh
207+
./$<
207208
touch $@
208209

209-
validateportlistingparse: testportlistingparse
210+
validateportlistingparse: $(BUILD)/testportlistingparse
210211
@echo "portlistingparse validation test"
211-
./testportlistingparse
212+
./$<
212213
touch $@
213214

214-
validateigddescparse: testigddescparse
215+
validateigddescparse: $(BUILD)/testigddescparse
215216
@echo "igd desc parse validation test"
216-
./testigddescparse testdesc/new_LiveBox_desc.xml testdesc/new_LiveBox_desc.values
217-
./testigddescparse testdesc/linksys_WAG200G_desc.xml testdesc/linksys_WAG200G_desc.values
217+
./$< testdesc/new_LiveBox_desc.xml testdesc/new_LiveBox_desc.values
218+
./$< testdesc/linksys_WAG200G_desc.xml testdesc/linksys_WAG200G_desc.values
218219
touch $@
219220

220-
validateaddr_is_reserved: testaddr_is_reserved
221+
validateaddr_is_reserved: $(BUILD)/testaddr_is_reserved
221222
@echo "addr_is_reserved() validation test"
222-
./testaddr_is_reserved
223+
./$<
223224
touch $@
224225

225226
clean:
226-
$(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) miniupnpcstrings.h
227+
$(RM) $(LIBRARY) $(SHAREDLIBRARY) $(EXECUTABLES) $(OBJS) $(BUILDINCLUDES)
227228
$(RM) $(EXECUTABLES_ADDTESTS)
228229
# clean python stuff
229230
$(RM) pythonmodule pythonmodule3
@@ -281,7 +282,8 @@ cleaninstall:
281282
$(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(LIBRARY)
282283
$(RM) $(DESTDIR)$(INSTALLDIRLIB)/$(SHAREDLIBRARY)
283284

284-
miniupnpc.pc: VERSION
285+
$(BUILD)/miniupnpc.pc: VERSION
286+
@$(MKDIR) $(BUILD)
285287
$(RM) $@
286288
echo "prefix=$(INSTALLPREFIX)" >> $@
287289
echo "exec_prefix=\$${prefix}" >> $@
@@ -294,8 +296,7 @@ miniupnpc.pc: VERSION
294296
echo "Libs: -L\$${libdir} -lminiupnpc" >> $@
295297
echo "Cflags: -I\$${includedir}" >> $@
296298

297-
depend:
298-
makedepend -Y -- $(CFLAGS) $(CPPFLAGS) -- $(SRCS) 2>/dev/null
299+
depend: $(DEPS)
299300

300301
$(LIBRARY): $(LIBOBJS)
301302
ifneq (, $(findstring darwin, $(OS)))
@@ -312,30 +313,39 @@ else
312313
$(CC) -shared $(LDFLAGS) -Wl,-soname,$(SONAME) -o $@ $^
313314
endif
314315

315-
upnpc-static: upnpc.o $(LIBRARY)
316+
$(BUILD)/%.o: $(SRCDIR)/%.c $(BUILD)/%.d
317+
$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
318+
319+
$(DEPS): $(BUILDINCLUDES)
320+
321+
$(BUILD)/%.d: $(SRCDIR)/%.c
322+
@$(MKDIR) $(@D)
323+
$(CC) $(CPPFLAGS) $(DEPFLAGS) -MT $@ -o $@ $<
324+
325+
$(BUILD)/upnpc-static: $(BUILD)/upnpc.o $(LIBRARY)
316326
$(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
317327

318-
upnpc-shared: upnpc.o $(SHAREDLIBRARY)
328+
$(BUILD)/upnpc-shared: $(BUILD)/upnpc.o $(SHAREDLIBRARY)
319329
$(CC) $(LDFLAGS) -o $@ $^ $(LOADLIBES) $(LDLIBS)
320330

321-
listdevices: listdevices.o $(LIBRARY)
331+
$(BUILD)/listdevices: $(BUILD)/listdevices.o $(LIBRARY)
322332

323-
testminixml: $(TESTMINIXMLOBJS)
333+
$(BUILD)/testminixml: $(TESTMINIXMLOBJS)
324334

325-
testminiwget: $(TESTMINIWGETOBJS)
335+
$(BUILD)/testminiwget: $(TESTMINIWGETOBJS)
326336

327-
minixmlvalid: minixml.o minixmlvalid.o
337+
$(BUILD)/minixmlvalid: $(addprefix $(BUILD)/, minixml.o minixmlvalid.o)
328338

329-
testupnpreplyparse: $(TESTUPNPREPLYPARSE)
339+
$(BUILD)/testupnpreplyparse: $(TESTUPNPREPLYPARSE)
330340

331-
testigddescparse: $(TESTIGDDESCPARSE)
341+
$(BUILD)/testigddescparse: $(TESTIGDDESCPARSE)
332342

333-
testportlistingparse: $(TESTPORTLISTINGPARSE)
343+
$(BUILD)/testportlistingparse: $(TESTPORTLISTINGPARSE)
334344

335-
testaddr_is_reserved: $(TESTADDR_IS_RESERVED)
345+
$(BUILD)/testaddr_is_reserved: $(TESTADDR_IS_RESERVED)
336346

337-
miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION
338-
$(SH) updateminiupnpcstrings.sh
347+
$(BUILD)/miniupnpcstrings.h: miniupnpcstrings.h.in updateminiupnpcstrings.sh VERSION
348+
$(SH) updateminiupnpcstrings.sh $@ $<
339349

340350
# ftp tool supplied with OpenBSD can download files from http.
341351
jnaerator-%.jar:
@@ -375,51 +385,9 @@ ideb:
375385

376386
minihttptestserver: minihttptestserver.o
377387

378-
# DO NOT DELETE THIS LINE -- make depend depends on it.
379-
380-
igd_desc_parse.o: include/igd_desc_parse.h
381-
miniupnpc.o: include/miniupnpc.h include/miniupnpc_declspec.h
382-
miniupnpc.o: include/igd_desc_parse.h include/upnpdev.h minissdpc.h
383-
miniupnpc.o: include/miniwget.h miniwget_private.h miniupnpc_socketdef.h
384-
miniupnpc.o: minisoap.h minixml.h include/upnpcommands.h
385-
miniupnpc.o: include/miniupnpctypes.h connecthostport.h addr_is_reserved.h
386-
minixml.o: minixml.h
387-
minisoap.o: minisoap.h miniupnpc_socketdef.h miniupnpcstrings.h
388-
miniwget.o: miniupnpcstrings.h include/miniwget.h
389-
miniwget.o: include/miniupnpc_declspec.h connecthostport.h
390-
miniwget.o: miniupnpc_socketdef.h receivedata.h
391-
upnpc.o: include/miniwget.h include/miniupnpc_declspec.h include/miniupnpc.h
392-
upnpc.o: include/igd_desc_parse.h include/upnpdev.h include/upnpcommands.h
393-
upnpc.o: include/miniupnpctypes.h include/portlistingparse.h
394-
upnpc.o: include/upnperrors.h miniupnpcstrings.h
395-
upnpcommands.o: include/upnpcommands.h include/miniupnpc_declspec.h
396-
upnpcommands.o: include/miniupnpctypes.h include/miniupnpc.h
397-
upnpcommands.o: include/igd_desc_parse.h include/upnpdev.h
398-
upnpcommands.o: include/portlistingparse.h include/upnpreplyparse.h
399-
upnpreplyparse.o: include/upnpreplyparse.h minixml.h
400-
testminixml.o: minixml.h include/igd_desc_parse.h
401-
minixmlvalid.o: minixml.h
402-
testupnpreplyparse.o: include/upnpreplyparse.h
403-
minissdpc.o: miniupnpc_socketdef.h minissdpc.h include/miniupnpc_declspec.h
404-
minissdpc.o: include/upnpdev.h include/miniupnpc.h include/igd_desc_parse.h
405-
minissdpc.o: receivedata.h codelength.h
406-
upnperrors.o: include/upnperrors.h include/miniupnpc_declspec.h
407-
upnperrors.o: include/upnpcommands.h include/miniupnpctypes.h
408-
upnperrors.o: include/miniupnpc.h include/igd_desc_parse.h include/upnpdev.h
409-
testigddescparse.o: include/igd_desc_parse.h minixml.h include/miniupnpc.h
410-
testigddescparse.o: include/miniupnpc_declspec.h include/upnpdev.h
411-
testminiwget.o: include/miniwget.h include/miniupnpc_declspec.h
412-
connecthostport.o: connecthostport.h miniupnpc_socketdef.h
413-
portlistingparse.o: include/portlistingparse.h include/miniupnpc_declspec.h
414-
portlistingparse.o: include/miniupnpctypes.h minixml.h
415-
receivedata.o: receivedata.h miniupnpc_socketdef.h
416-
upnpdev.o: include/upnpdev.h include/miniupnpc_declspec.h
417-
testportlistingparse.o: include/portlistingparse.h
418-
testportlistingparse.o: include/miniupnpc_declspec.h include/miniupnpctypes.h
419-
miniupnpcmodule.o: include/miniupnpc.h include/miniupnpc_declspec.h
420-
miniupnpcmodule.o: include/igd_desc_parse.h include/upnpdev.h
421-
miniupnpcmodule.o: include/upnpcommands.h include/miniupnpctypes.h
422-
miniupnpcmodule.o: include/upnperrors.h
423-
testaddr_is_reserved.o: addr_is_reserved.h
424-
listdevices.o: include/miniupnpc.h include/miniupnpc_declspec.h
425-
listdevices.o: include/igd_desc_parse.h include/upnpdev.h
388+
print-%:
389+
@echo "$* = $($*)"
390+
391+
ifneq ($(MAKECMDGOALS),clean)
392+
-include $(DEPS)
393+
endif

‎setup.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import subprocess
1414
import os
1515

16-
EXT = ['libminiupnpc.a']
16+
EXT = ['build/libminiupnpc.a']
1717

1818
class make_then_build_ext(build_ext.build_ext):
1919
def run(self):
@@ -29,7 +29,7 @@ def run(self):
2929
description='miniUPnP client',
3030
cmdclass={'build_ext': make_then_build_ext},
3131
ext_modules=[
32-
Extension(name="miniupnpc", sources=["miniupnpcmodule.c"],
32+
Extension(name="miniupnpc", sources=["src/miniupnpcmodule.c"],
3333
include_dirs=['include'], extra_objects=EXT)
3434
])
3535

File renamed without changes.
File renamed without changes.

‎codelength.h ‎src/codelength.h

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎listdevices.c ‎src/listdevices.c

File renamed without changes.
File renamed without changes.

‎minisoap.c ‎src/minisoap.c

File renamed without changes.

‎minisoap.h ‎src/minisoap.h

File renamed without changes.

‎minissdpc.c ‎src/minissdpc.c

File renamed without changes.

‎minissdpc.h ‎src/minissdpc.h

File renamed without changes.

‎miniupnpc.c ‎src/miniupnpc.c

File renamed without changes.
File renamed without changes.
File renamed without changes.

‎miniwget.c ‎src/miniwget.c

File renamed without changes.
File renamed without changes.

‎minixml.c ‎src/minixml.c

File renamed without changes.

‎minixml.h ‎src/minixml.h

File renamed without changes.

‎minixmlvalid.c ‎src/minixmlvalid.c

File renamed without changes.
File renamed without changes.

‎receivedata.c ‎src/receivedata.c

File renamed without changes.

‎receivedata.h ‎src/receivedata.h

File renamed without changes.
File renamed without changes.
File renamed without changes.

‎testminiwget.c ‎src/testminiwget.c

File renamed without changes.

‎testminixml.c ‎src/testminixml.c

File renamed without changes.
File renamed without changes.
File renamed without changes.

‎upnpc.c ‎src/upnpc.c

File renamed without changes.

‎upnpcommands.c ‎src/upnpcommands.c

File renamed without changes.

‎upnpdev.c ‎src/upnpdev.c

File renamed without changes.

‎upnperrors.c ‎src/upnperrors.c

File renamed without changes.
File renamed without changes.
File renamed without changes.

‎testminiwget.sh

+13-7
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# it should now also run with dash
1818

1919
TMPD=`mktemp -d -t miniwgetXXXXXXXXXX`
20+
TESTSERVER=./build/minihttptestserver
21+
TESTMINIWGET=./build/testminiwget
2022
HTTPSERVEROUT="${TMPD}/httpserverout"
2123
EXPECTEDFILE="${TMPD}/expectedfile"
2224
DOWNLOADEDFILE="${TMPD}/downloadedfile"
@@ -50,11 +52,15 @@ case "$HAVE_IPV6" in
5052

5153
esac
5254

53-
#make minihttptestserver
54-
#make testminiwget
55+
if [ ! -x "$TESTSERVER" ] || [ ! -x "$TESTMINIWGET" ] ; then
56+
echo "Please build $TESTSERVER and $TESTMINIWGET"
57+
#make minihttptestserver
58+
#make testminiwget
59+
exit 1
60+
fi
5561

5662
# launching the test HTTP server
57-
./minihttptestserver $SERVERARGS -e $EXPECTEDFILE > $HTTPSERVEROUT &
63+
$TESTSERVER $SERVERARGS -e $EXPECTEDFILE > $HTTPSERVEROUT &
5864
SERVERPID=$!
5965
while [ -z "$PORT" ]; do
6066
sleep 1
@@ -74,7 +80,7 @@ URL3="http://$ADDR:$PORT/addcrap"
7480
URL4="http://$ADDR:$PORT/malformed"
7581

7682
echo "standard test ..."
77-
./testminiwget $URL1 "${DOWNLOADEDFILE}.1"
83+
$TESTMINIWGET $URL1 "${DOWNLOADEDFILE}.1"
7884
if cmp $EXPECTEDFILE "${DOWNLOADEDFILE}.1" ; then
7985
echo "ok"
8086
else
@@ -83,7 +89,7 @@ else
8389
fi
8490

8591
echo "chunked transfert encoding test ..."
86-
./testminiwget $URL2 "${DOWNLOADEDFILE}.2"
92+
$TESTMINIWGET $URL2 "${DOWNLOADEDFILE}.2"
8793
if cmp $EXPECTEDFILE "${DOWNLOADEDFILE}.2" ; then
8894
echo "ok"
8995
else
@@ -92,7 +98,7 @@ else
9298
fi
9399

94100
echo "response too long test ..."
95-
./testminiwget $URL3 "${DOWNLOADEDFILE}.3"
101+
$TESTMINIWGET $URL3 "${DOWNLOADEDFILE}.3"
96102
if cmp $EXPECTEDFILE "${DOWNLOADEDFILE}.3" ; then
97103
echo "ok"
98104
else
@@ -101,7 +107,7 @@ else
101107
fi
102108

103109
echo "malformed response test ..."
104-
./testminiwget $URL4 "${DOWNLOADEDFILE}.4"
110+
$TESTMINIWGET $URL4 "${DOWNLOADEDFILE}.4"
105111

106112
# kill the test HTTP server
107113
kill $SERVERPID

‎testupnpreplyparse.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
#!/bin/sh
22

3+
TESTUPNPREPLYPARSE=./build/testupnpreplyparse
4+
35
for f in testreplyparse/*.xml ; do
46
bf="`dirname $f`/`basename $f .xml`"
5-
if ./testupnpreplyparse $f $bf.namevalue ; then
7+
if $TESTUPNPREPLYPARSE $f $bf.namevalue ; then
68
echo "$f : passed"
79
else
810
echo "$f : FAILED"

‎updateminiupnpcstrings.sh

+10-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
#! /bin/sh
22
# $Id: updateminiupnpcstrings.sh,v 1.7 2011/01/04 11:41:53 nanard Exp $
33
# project miniupnp : http://miniupnp.free.fr/
4-
# (c) 2009 Thomas Bernard
4+
# (c) 2009-2021 Thomas Bernard
55

66
FILE=miniupnpcstrings.h
7-
TMPFILE=miniupnpcstrings.h.tmp
87
TEMPLATE_FILE=${FILE}.in
98

9+
if [ -n "$1" ] ; then
10+
FILE="$1"
11+
fi
12+
if [ -n "$2" ] ; then
13+
TEMPLATE_FILE="$2"
14+
fi
15+
TMPFILE=`mktemp -t miniupnpcstrings`
16+
1017
# detecting the OS name and version
1118
OS_NAME=`uname -s`
1219
OS_VERSION=`uname -r`
@@ -49,5 +56,5 @@ sed -e "$EXPR" < $TEMPLATE_FILE > $TMPFILE
4956
EXPR="s|MINIUPNPC_VERSION_STRING \".*\"|MINIUPNPC_VERSION_STRING \"${MINIUPNPC_VERSION}\"|"
5057
echo "setting MINIUPNPC_VERSION_STRING macro value to ${MINIUPNPC_VERSION} in $FILE."
5158
sed -e "$EXPR" < $TMPFILE > $FILE
52-
rm $TMPFILE
59+
rm -v $TMPFILE
5360

0 commit comments

Comments
 (0)
Please sign in to comment.