tiny-json/examples/makefile

34 lines
560 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)
2019-03-28 00:24:37 +00:00
src += $(wildcard ../*.c)
2018-11-17 00:21:12 +00:00
obj = $(src:.c=.o)
dep = $(obj:.o=.d)
2019-03-28 00:24:37 +00:00
.PHONY: build all clean
2016-10-12 21:08:38 +00:00
2019-03-28 00:24:37 +00:00
build: example-01.exe example-02.exe example-03.exe
2016-10-12 21:08:38 +00:00
all: clean build
2019-03-28 00:24:37 +00:00
clean::
rm -rf $(dep)
rm -rf $(obj)
rm -rf *.exe
2016-10-12 21:08:38 +00:00
2019-03-28 00:24:37 +00:00
example-01.exe: example-01.o ../tiny-json.o
gcc $(CFLAGS) -o $@ $^
2016-10-12 21:08:38 +00:00
2019-03-28 00:24:37 +00:00
example-02.exe: example-02.o ../tiny-json.o
gcc $(CFLAGS) -o $@ $^
2019-03-28 00:24:37 +00:00
example-03.exe: example-03.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) >$@