forked from liexusong/mjs3
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
39 lines (30 loc) · 946 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
32
33
34
35
36
37
38
39
PROG = elk
DBG ?=
#MFLAGS += -DJS_DEBUG
TFLAGS += -DJS_STRING_POOL_SIZE=512
CFLAGS += -W -Wall -Werror -Wstrict-overflow -fno-strict-aliasing -Os -g
GCOV ?= true
ifeq ($(CC),clang)
CFLAGS += -coverage
GCOV = gcov
endif
all: $(PROG) test cpptest vc98 test98
.PHONY: test $(PROG)
$(PROG): elk.c example.c
$(CC) -o $@ example.c -DNDEBUG $(CFLAGS) $(MFLAGS)
test: clean unit_test.c elk.c
$(CC) -o $@ unit_test.c $(CFLAGS) $(MFLAGS) $(TFLAGS)
@$(DBG) ./$@
-@$(GCOV) unit_test.c
cpptest:
$(CXX) -x c++ -o $@ unit_test.c $(CFLAGS) $(MFLAGS) $(TFLAGS)
$(DBG) ./$@
VC98 = docker run -v $(CURDIR):$(CURDIR) -w $(CURDIR) docker.io/mgos/vc98
VCFLAGS = /nologo /W4 /O1
vc98: elk.c example.c
$(VC98) wine cl example.c $(VCFLAGS) /DNDEBUG $(MFLAGS) /Fe$(PROG).exe
test98: unit_test.c elk.c
$(VC98) wine cl unit_test.c $(VCFLAGS) $(MFLAGS) $(TFLAGS) /[email protected]
$(VC98) wine [email protected]
clean:
rm -rf $(PROG) *test *.exe *.obj *.dSYM example *.gc*