tiny-json/makefile

36 lines
575 B
Makefile
Raw Normal View History

2018-11-15 00:08:21 +00:00
CC = gcc
CFLAGS = -std=c99 -Wall -pedantic
2016-10-12 21:08:38 +00:00
2018-11-17 00:21:12 +00:00
src = $(wildcard *.c)
obj = $(src:.c=.o)
dep = $(obj:.o=.d)
build: example-01.exe example-02.exe example-03.exe
2016-10-12 21:08:38 +00:00
clean:
2018-11-17 00:21:12 +00:00
rm -rf *.d
2016-10-12 21:08:38 +00:00
rm -rf *.o
rm -rf *.exe
all: clean build
2017-04-03 00:43:31 +00:00
test: test.exe
./test.exe
2016-10-18 23:16:30 +00:00
example-01.exe: example-01.o tiny-json.o
gcc $(CFLAGS) -o $@ $^
2016-10-12 21:08:38 +00:00
2016-10-18 23:16:30 +00:00
example-02.exe: example-02.o tiny-json.o
gcc $(CFLAGS) -o $@ $^
2016-10-12 21:08:38 +00:00
example-03.exe: example-03.o tiny-json.o
gcc $(CFLAGS) -o $@ $^
2017-04-03 00:43:31 +00:00
test.exe: tests.o tiny-json.o
2018-11-15 00:08:21 +00:00
gcc $(CFLAGS) -o $@ $^
2018-11-17 00:21:12 +00:00
-include $(dep)
%.d: %.c
$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@