mirror of
https://github.com/rafagafe/tiny-json.git
synced 2025-03-12 19:25:30 +00:00
38 lines
809 B
Makefile
38 lines
809 B
Makefile
|
|
CC = gcc
|
|
CFLAGS = -std=c99 -Wall -pedantic -I. -I.. -I../../json-maker -DJSON_REVERSER
|
|
|
|
src = $(wildcard *.c)
|
|
src += $(wildcard ../*.c)
|
|
obj = $(src:.c=.o)
|
|
dep = $(obj:.o=.d)
|
|
|
|
.PHONY: build all clean
|
|
|
|
build: example-01.exe example-02.exe example-03.exe example-04.exe
|
|
|
|
all: clean build
|
|
|
|
clean::
|
|
rm -rf $(dep)
|
|
rm -rf $(obj)
|
|
rm -rf *.exe
|
|
|
|
|
|
example-01.exe: example-01.o ../tiny-json.o ../../json-maker/json-maker.o
|
|
gcc $(CFLAGS) -o $@ $^
|
|
|
|
example-02.exe: example-02.o ../tiny-json.o ../../json-maker/json-maker.o
|
|
gcc $(CFLAGS) -o $@ $^
|
|
|
|
example-03.exe: example-03.o ../tiny-json.o ../../json-maker/json-maker.o
|
|
gcc $(CFLAGS) -o $@ $^
|
|
|
|
example-04.exe: example-04.o ../tiny-json.o ../../json-maker/json-maker.o
|
|
gcc $(CFLAGS) -o $@ $^
|
|
|
|
-include $(dep)
|
|
|
|
%.d: %.c
|
|
$(CC) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@
|