Edwin Wong | 27b5a35 | 2014-05-28 15:36:44 -0700 | [diff] [blame] | 1 | # You can put your build options here |
| 2 | -include config.mk |
| 3 | |
Haibo Huang | 8e49843 | 2018-09-06 14:52:29 -0700 | [diff] [blame^] | 4 | all: libjsmn.a |
Edwin Wong | 27b5a35 | 2014-05-28 15:36:44 -0700 | [diff] [blame] | 5 | |
| 6 | libjsmn.a: jsmn.o |
| 7 | $(AR) rc $@ $^ |
| 8 | |
| 9 | %.o: %.c jsmn.h |
| 10 | $(CC) -c $(CFLAGS) $< -o $@ |
| 11 | |
Haibo Huang | 8e49843 | 2018-09-06 14:52:29 -0700 | [diff] [blame^] | 12 | test: test_default test_strict test_links test_strict_links |
| 13 | test_default: test/tests.c |
| 14 | $(CC) $(CFLAGS) $(LDFLAGS) $< -o test/$@ |
| 15 | ./test/$@ |
| 16 | test_strict: test/tests.c |
| 17 | $(CC) -DJSMN_STRICT=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@ |
| 18 | ./test/$@ |
| 19 | test_links: test/tests.c |
| 20 | $(CC) -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@ |
| 21 | ./test/$@ |
| 22 | test_strict_links: test/tests.c |
| 23 | $(CC) -DJSMN_STRICT=1 -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@ |
| 24 | ./test/$@ |
Edwin Wong | 27b5a35 | 2014-05-28 15:36:44 -0700 | [diff] [blame] | 25 | |
| 26 | jsmn_test.o: jsmn_test.c libjsmn.a |
| 27 | |
Haibo Huang | 8e49843 | 2018-09-06 14:52:29 -0700 | [diff] [blame^] | 28 | simple_example: example/simple.o libjsmn.a |
| 29 | $(CC) $(LDFLAGS) $^ -o $@ |
| 30 | |
| 31 | jsondump: example/jsondump.o libjsmn.a |
| 32 | $(CC) $(LDFLAGS) $^ -o $@ |
| 33 | |
Edwin Wong | 27b5a35 | 2014-05-28 15:36:44 -0700 | [diff] [blame] | 34 | clean: |
Haibo Huang | 8e49843 | 2018-09-06 14:52:29 -0700 | [diff] [blame^] | 35 | rm -f *.o example/*.o |
| 36 | rm -f *.a *.so |
| 37 | rm -f simple_example |
| 38 | rm -f jsondump |
Edwin Wong | 27b5a35 | 2014-05-28 15:36:44 -0700 | [diff] [blame] | 39 | |
| 40 | .PHONY: all clean test |
| 41 | |