Differences From
Artifact [b49975ddb0]:
5 5 terra $(dbg-flags) $<
6 6 parsav.o: parsav.t config.lua pkgdata.lua
7 7 env parsav_link=no terra $(dbg-flags) $<
8 8
9 9 clean:
10 10 rm parsav parsav.o
11 11
12 -dep: dep.mbedtls dep.libhttp dep.json-c
12 +install: parsav
13 + mkdir $(prefix)/bin
14 + cp $< $(prefix)/bin/
15 +
16 +dep: dep.mbedtls dep.mongoose dep.json-c
13 17 dep.mbedtls: lib/mbedtls/library/libmbedtls.a \
14 18 lib/mbedtls/library/libmbedcrypto.a \
15 19 lib/mbedtls/library/libmbedx509.a
16 -dep.libhttp: lib/libhttp/lib/libhttp.a
17 -dep.json-c: lib/libhttp/json-c.a
20 +dep.mongoose: lib/mongoose/libmongoose.a
21 +dep.json-c: lib/json-c/libjson-c.a
18 22
19 23 lib:
20 24 mkdir $@
21 25 # parsav is designed to be fronted by a real web
22 26 # server like nginx if SSL is to be used
23 -# caveat: libhttp is a mess. the docs are completely
24 -# full of shit. there is no lua support as far as i
25 -# can tell.
26 -lib/libhttp/lib/libhttp.a: lib/libhttp
27 - $(MAKE) -C $< lib/libhttp.a \
28 - RM='rm -f' \
29 - CC="$(CC) -Wno-unused-result" \
30 - DFLAGS="-DNO_SSL -DNO_FILES -DNO_CGI -DUSE_STACK_SIZE=102400 -DUSE_IPV6"
27 +# generate a shim static library so mongoose cooperates
28 +# with the build apparatus
29 +lib/mongoose/libmongoose.a: lib/mongoose lib/mongoose/mongoose.c lib/mongoose/mongoose.h
30 + $(CC) -c $</mongoose.c -o lib/mongoose/mongoose.o \
31 + -DMG_ENABLE_THREADS \
32 + -DMG_ENABLE_IPV6 \
33 + -DMG_ENABLE_HTTP_WEBDAV \
34 + -DMG_ENABLE_HTTP_WEBSOCKET=0
35 + ar rcs $@ lib/mongoose/*.o
36 + ranlib $@
31 37
32 38 lib/json-c/Makefile: lib/json-c lib/json-c/CMakeLists.txt
33 39 cd lib/json-c && cmake .
34 40 lib/json-c/libjson-c.a: lib/json-c/Makefile
35 41 $(MAKE) -C lib/json-c
36 42 lib/mbedtls/library/%.a: lib/mbedtls
37 43 $(MAKE) -C lib/mbedtls/library $*.a
38 44
39 45 ifeq ($(dl), git)
40 -lib/libhttp: lib
41 - cd lib && git clone https://github.com/lammertb/libhttp.git
46 +lib/mongoose: lib
47 + cd lib && git clone https://github.com/cesanta/mongoose
42 48 lib/mbedtls: lib
43 49 cd lib && git clone https://github.com/ARMmbed/mbedtls.git
44 50 lib/json-c: lib
45 51 cd lib && git clone https://github.com/json-c/json-c.git
46 52 else
47 53 lib/%: lib/%.tar.gz
48 54 cd lib && tar zxf $*.tar.gz
................................................................................
52 58 dlfile = wget "$(1)" -O "$(2)"
53 59 endif
54 60
55 61 ifeq ($(dl), curl)
56 62 dlfile = curl "$(1)" -o "$(2)"
57 63 endif
58 64
59 -lib/libhttp.tar.gz: lib
60 - $(call dlfile,https://api.github.com/repos/lammertb/libhttp/tarball/master,$@)
65 +lib/mongoose.tar.gz: lib
66 + $(call dlfile,https://api.github.com/repos/cesanta/mongoose/tarball/master,$@)
61 67 lib/mbedtls.tar.gz: lib
62 68 $(call dlfile,https://api.github.com/repos/ARMmbed/mbedtls/tarball/master,$@)
63 69 lib/json-c.tar.gz: lib
64 70 $(call dlfile,https://api.github.com/repos/json-c/json-c/tarball/master,$@)
65 71 endif