update makefile to use jsmn as a header-only library

modernize
Serge A. Zaitsev 6 years ago
parent 5a71f81222
commit bf2de432a2

@ -1,41 +1,36 @@
# You can put your build options here # You can put your build options here
all: libjsmn.a
-include config.mk -include config.mk
libjsmn.a: jsmn.o
$(AR) rc $@ $^
%.o: %.c jsmn.h
$(CC) -c $(CFLAGS) $< -o $@
test: test_default test_strict test_links test_strict_links test: test_default test_strict test_links test_strict_links
test_default: test/tests.c test_default: test/tests.c jsmn.h
$(CC) $(CFLAGS) $(LDFLAGS) $< -o test/$@ $(CC) $(CFLAGS) $(LDFLAGS) $< -o test/$@
./test/$@ ./test/$@
test_strict: test/tests.c test_strict: test/tests.c jsmn.h
$(CC) -DJSMN_STRICT=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@ $(CC) -DJSMN_STRICT=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@
./test/$@ ./test/$@
test_links: test/tests.c test_links: test/tests.c jsmn.h
$(CC) -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@ $(CC) -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@
./test/$@ ./test/$@
test_strict_links: test/tests.c test_strict_links: test/tests.c jsmn.h
$(CC) -DJSMN_STRICT=1 -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@ $(CC) -DJSMN_STRICT=1 -DJSMN_PARENT_LINKS=1 $(CFLAGS) $(LDFLAGS) $< -o test/$@
./test/$@ ./test/$@
jsmn_test.o: jsmn_test.c libjsmn.a simple_example: example/simple.c jsmn.h
$(CC) $(LDFLAGS) $< -o $@
jsondump: example/jsondump.c jsmn.h
$(CC) $(LDFLAGS) $< -o $@
simple_example: example/simple.o libjsmn.a fmt:
$(CC) $(LDFLAGS) $^ -o $@ clang-format -i jsmn.h test/*.[ch] example/*.[ch]
jsondump: example/jsondump.o libjsmn.a lint:
$(CC) $(LDFLAGS) $^ -o $@ clang-tidy jsmn.h --checks='*'
clean: clean:
rm -f *.o example/*.o rm -f *.o example/*.o
rm -f *.a *.so
rm -f simple_example rm -f simple_example
rm -f jsondump rm -f jsondump
.PHONY: all clean test .PHONY: clean test

Loading…
Cancel
Save