mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
Makefile improvements
This commit is contained in:
parent
917474e6f3
commit
1b49ff9605
3 changed files with 52 additions and 36 deletions
9
Makefile
9
Makefile
|
@ -1,17 +1,18 @@
|
||||||
.PHONY: doc
|
.PHONY: doc
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
.PHONY: lib
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@/bin/echo -e "Usage:\n\tmake diet - compile with diet libc\n\tmake glibc - compile with normal gnu libc\n\tmake test\n\tmake doc"
|
@/bin/echo -e "Usage:\n\tmake diet - compile with diet libc\n\tmake glibc - compile with normal gnu libc\n\tmake test\n\tmake doc"
|
||||||
|
|
||||||
glibc:
|
lib:
|
||||||
make -C src glibc
|
${MAKE} -C src lib
|
||||||
|
|
||||||
diet:
|
diet:
|
||||||
make -C src diet
|
${MAKE} -C src diet
|
||||||
|
|
||||||
test:
|
test:
|
||||||
make -C test
|
${MAKE} -C test
|
||||||
|
|
||||||
doc:
|
doc:
|
||||||
doxygen
|
doxygen
|
||||||
|
|
34
src/Makefile
34
src/Makefile
|
@ -1,24 +1,28 @@
|
||||||
CFLAGS=-I../include -DDEBUG=2 -DPSYC_COMPILE_LIBRARY -g -O0 -Wall
|
OPT = -O2
|
||||||
CC=cc
|
DEBUG = 2
|
||||||
# CC=clang
|
CFLAGS = -I../include -Wall ${OPT}
|
||||||
|
DIET = diet
|
||||||
|
WRAPPER =
|
||||||
|
|
||||||
test -z "$DIET" || DIET=diet
|
S = packet.c misc.c parser.c match.c render.c memmem.c itoa.c variable.c
|
||||||
|
O = packet.o misc.o parser.o match.o render.o memmem.o itoa.o variable.o
|
||||||
|
|
||||||
S=packet.c misc.c parser.c match.c render.c memmem.c itoa.c variable.c
|
all: lib
|
||||||
O=packet.o misc.o parser.o match.o render.o memmem.o itoa.o variable.o
|
|
||||||
|
|
||||||
default:
|
help:
|
||||||
@/bin/echo -e "Usage:\n\tmake diet - compile with diet libc\n\tmake lib - compile with normal gnu libc"
|
@/bin/echo -e "Usage:\n\tmake diet - compile with diet libc\n\tmake lib - compile with normal gnu libc"
|
||||||
|
|
||||||
diet:
|
debug: CFLAGS += -DDEBUG=${DEBUG} -g
|
||||||
${DIET} ${CC} -static -c -Os $S ${CFLAGS}
|
debug: CFLAGS := $(subst ${OPT},-O0,${CFLAGS})
|
||||||
@test -d ../lib || mkdir ../lib
|
debug: lib
|
||||||
${DIET} ar rcs ../lib/libpsyc.a $O
|
|
||||||
|
|
||||||
glibc: $S
|
diet: WRAPPER = ${DIET}
|
||||||
${CC} -static -c -g -O0 $S -lc ${CFLAGS}
|
diet: lib
|
||||||
@test -d ../lib || mkdir ../lib
|
|
||||||
ar rcs ../lib/libpsyc.a $O
|
lib: CC := ${WRAPPER} ${CC}
|
||||||
|
lib: $O
|
||||||
|
@mkdir -p ../lib
|
||||||
|
${WRAPPER} ar rcs ../lib/libpsyc.a $O
|
||||||
|
|
||||||
match: match.c
|
match: match.c
|
||||||
${CC} -o $@ -DDEBUG=4 -DCMDTOOL -DTEST $<
|
${CC} -o $@ -DDEBUG=4 -DCMDTOOL -DTEST $<
|
||||||
|
|
|
@ -1,40 +1,51 @@
|
||||||
CFLAGS=-I../include -DDEBUG -g -O0 -Wall
|
OPT = -O2
|
||||||
LDFLAGS=-L../lib
|
DEBUG = 2
|
||||||
LOADLIBES=-lpsyc -lm
|
CFLAGS = -I../include -Wall ${OPT}
|
||||||
TARGETS=testServer testParser testMatch testRender isRoutingVar getVarType
|
LDFLAGS = -L../lib
|
||||||
PORT=4440
|
LOADLIBES = -lpsyc -lm
|
||||||
|
TARGETS = testServer testParser testMatch testRender isRoutingVar getVarType
|
||||||
|
WRAPPER =
|
||||||
|
DIET = diet
|
||||||
|
PORT = 4440
|
||||||
|
|
||||||
all: $(TARGETS)
|
all: test
|
||||||
|
|
||||||
|
diet: WRAPPER = ${DIET}
|
||||||
|
diet: all
|
||||||
|
|
||||||
|
debug: CFLAGS += -DDEBUG=${DEBUG} -g
|
||||||
|
debug: CFLAGS := $(subst ${OPT},-O0,${CFLAGS})
|
||||||
|
debug: all
|
||||||
|
|
||||||
|
test: ${TARGETS}
|
||||||
./testRender
|
./testRender
|
||||||
./testMatch
|
./testMatch
|
||||||
./isRoutingVar
|
./isRoutingVar
|
||||||
./getVarType
|
./getVarType
|
||||||
|
for f in packets/full-*; do echo ">> $$f"; ./testParser $$f; done
|
||||||
test: $(TARGETS)
|
|
||||||
for f in packets/full-* packets/error-*; do echo ">> $$f"; ./testParser $$f; done
|
|
||||||
|
|
||||||
netstart:
|
netstart:
|
||||||
./testServer $(PORT)
|
./testServer ${PORT}
|
||||||
|
|
||||||
netstartv:
|
netstartv:
|
||||||
./testServer $(PORT) -v
|
./testServer ${PORT} -v
|
||||||
|
|
||||||
nettest:
|
nettest:
|
||||||
for f in packets/full-*; do echo ">> $$f"; cat $$f | nc localhost $(PORT) | diff -u $$f -; done
|
for f in packets/full-*; do echo ">> $$f"; cat $$f | nc localhost ${PORT} | diff -u $$f -; done
|
||||||
|
|
||||||
nettesterr:
|
nettesterr:
|
||||||
for f in packets/error-*; do echo ">> $$f"; cat $$f | nc localhost $(PORT); done
|
for f in packets/error-*; do echo ">> $$f"; cat $$f | nc localhost ${PORT}; done
|
||||||
|
|
||||||
splittest:
|
splittest:
|
||||||
for f in packets/full-*; do echo ">> $$f"; ./splittest.pl $$f $(PORT) | diff -u $$f -; done
|
for f in packets/full-*; do echo ">> $$f"; ./splittest.pl $$f ${PORT} | diff -u $$f -; done
|
||||||
|
|
||||||
nettestp1:
|
nettestp1:
|
||||||
(for f in packets/part-1-p*; do cat $$f; done) | nc localhost $(PORT) | diff -u packets/full-1 -
|
(for f in packets/part-1-p*; do cat $$f; done) | nc localhost ${PORT} | diff -u packets/full-1 -
|
||||||
|
|
||||||
nettestp2:
|
nettestp2:
|
||||||
(for f in packets/part-1-length-p*; do cat $$f; done) | nc localhost $(PORT) | diff -u packets/full-1-length -
|
(for f in packets/part-1-length-p*; do cat $$f; done) | nc localhost ${PORT} | diff -u packets/full-1-length -
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(TARGETS)
|
rm -f ${TARGETS}
|
||||||
|
|
||||||
it: all
|
it: all
|
||||||
|
|
Loading…
Reference in a new issue