summaryrefslogtreecommitdiff
path: root/src/shim/mkjson/makefile
blob: ba75399d287a7569e5884e961cc034162905bd2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
CFLAGS = -Wall -Os -I.
CC = gcc
AR = ar

#USE_ASPRINTF make flag can be used in order to encourage asprintf use inside the library
ifeq ($(USE_ASPRINTF),1)
CFLAGS += -D_GNU_SOURCE
endif

#Builds object and a static library file
all: clean force
	$(CC) $(CFLAGS) -c mkjson.c -o obj/mkjson.o
	$(AR) -cvq lib/libmkjson.a obj/mkjson.o
	$(AR) -t lib/libmkjson.a

#Normal cleanup
clean:
	-rm -rf obj
	-rm -rf lib

#Environment init
force:
	-mkdir obj
	-mkdir lib

#Build the example snippet
example: all
	gcc -o example examples/example.c -I. -Llib -lmkjson