-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
31 lines (24 loc) · 908 Bytes
/
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
OBJDIR=.obj
CC=clang
CFLAGS=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d -Wno-array-bounds
LDFLAGS=-flto
CFLAGS_OPT=$(CFLAGS) -O2 -flto
DEFINES:=-D_GNU_SOURCE
CFLAGS+=$(DEFINES)
LIBS=/usr/local/lib/quickjs/libquickjs.a
INCLUDES=-I/usr/local/include/quickjs
$(OBJDIR):
mkdir -p $(OBJDIR)
webserver_test: $(OBJDIR) $(OBJDIR)/webserver.o $(OBJDIR)/webserver_test.o
$(CC) $(LDFLAGS) $(CFLAGS_OPT) -o $@ $(OBJDIR)/webserver_test.o $(OBJDIR)/webserver.o $(LIBS) -lm -ldl
strip webserver_test
$(OBJDIR)/webserver.o: ./c/webserver.c
$(CC) $(LDFLAGS) $(CFLAGS_OPT) -c $(INCLUDES) -o $@ ./c/webserver.c
$(OBJDIR)/webserver_test.o: webserver_test.c
$(CC) $(LDFLAGS) $(CFLAGS_OPT) -c $(INCLUDES) -o $@ webserver_test.c
webserver_test.c: webserver_test.js
qjsc -flto -D src/worker/server_worker.js -e -M webserver,webserver -m -o $@ webserver_test.js
clean:
rm ./webserver_test
rm webserver_test.c
rm -rf $(OBJDIR)