blob: f89701fddd65005922522aafce885de28db60557 [file] [log] [blame]
Edwin Wong27b5a352014-05-28 15:36:44 -07001# You can put your build options here
2-include config.mk
3
Haibo Huang8e498432018-09-06 14:52:29 -07004all: libjsmn.a
Edwin Wong27b5a352014-05-28 15:36:44 -07005
6libjsmn.a: jsmn.o
7 $(AR) rc $@ $^
8
9%.o: %.c jsmn.h
10 $(CC) -c $(CFLAGS) $< -o $@
11
Haibo Huang8e498432018-09-06 14:52:29 -070012test: test_default test_strict test_links test_strict_links
13test_default: test/tests.c
14 $(CC) $(CFLAGS) $(LDFLAGS) $< -o test/$@
15 ./test/$@
16test_strict: test/tests.c
17 $(CC) -DJSMN_STRICT=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@
18 ./test/$@
19test_links: test/tests.c
20 $(CC) -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@
21 ./test/$@
22test_strict_links: test/tests.c
23 $(CC) -DJSMN_STRICT=1 -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@
24 ./test/$@
Edwin Wong27b5a352014-05-28 15:36:44 -070025
26jsmn_test.o: jsmn_test.c libjsmn.a
27
Haibo Huang8e498432018-09-06 14:52:29 -070028simple_example: example/simple.o libjsmn.a
29 $(CC) $(LDFLAGS) $^ -o $@
30
31jsondump: example/jsondump.o libjsmn.a
32 $(CC) $(LDFLAGS) $^ -o $@
33
Edwin Wong27b5a352014-05-28 15:36:44 -070034clean:
Haibo Huang8e498432018-09-06 14:52:29 -070035 rm -f *.o example/*.o
36 rm -f *.a *.so
37 rm -f simple_example
38 rm -f jsondump
Edwin Wong27b5a352014-05-28 15:36:44 -070039
40.PHONY: all clean test
41