summaryrefslogtreecommitdiffhomepage
path: root/examples/c/Makefile
blob: 0b0fc312ad3f72a3a67924ebe4b14738f79de6ec (plain) (blame)
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
include ../../shared.mk

CFLAGS	+= -I../../src/c/include
LIBS     = -L../../src/c -lunit-wasm

SDIR = examples/c

LUW_SRCDIR = ../../src/c

luw_deps = $(LUW_SRCDIR)/libunit-wasm.a \
	   $(LUW_SRCDIR)/include/unit/unit-wasm.h

examples: examples-luw

examples-luw: luw-echo-request.wasm \
	      luw-upload-reflector.wasm \
	      large-upload.wasm

examples-raw: echo-request-raw.wasm upload-reflector-raw.wasm

luw-echo-request.wasm: luw-echo-request.c $(luw_deps)
	$(PP_CCLNK) $(SDIR)/$@
	$(v)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)

luw-upload-reflector.wasm: luw-upload-reflector.c $(luw_deps)
	$(PP_CCLNK) $(SDIR)/$@
	$(v)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)

unit-wasm-raw.o: unit-wasm-raw.c unit-wasm-raw.h
	$(PP_CC) $(SDIR)/$@
	$(v)$(CC) $(CFLAGS) -c $<

echo-request-raw.wasm: echo-request-raw.c unit-wasm-raw.o
	$(PP_CCLNK) $(SDIR)/$@
	$(v)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< unit-wasm-raw.o

upload-reflector-raw.wasm: upload-reflector-raw.c unit-wasm-raw.o
	$(PP_CCLNK) $(SDIR)/$@
	$(v)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< unit-wasm-raw.o

large-upload.wasm: large-upload.c $(luw_deps)
	$(PP_CCLNK) $(SDIR)/$@
	$(v)$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)

clean:
	rm -f *.wasm *.o *.gch