-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
62 lines (49 loc) · 1.06 KB
/
Makefile
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#libxml options
LIBXML_LIBS=$(shell xml2-config --libs)
LIBXML_CFLAGS=$(shell xml2-config --cflags)
## Platform
UNAME := $(shell $(CC) -dumpmachine 2>&1 | grep -E -o "linux|darwin")
ifeq ($(UNAME), linux)
OSFLAGS = -DLINUX -D_GNU_SOURCE
DEBUG = -g -ggdb
else ifeq ($(UNAME), darwin)
OSFLAGS = -DMACOSX -D_BSD_SOURCE
DEBUG = -g
endif
CFLAGS=$(LIBXML_CFLAGS) \
-O0 \
$(OSFLAGS) \
$(DEBUG) \
-pedantic \
-Wall \
-Wextra \
-Wshadow \
-Wformat=2 \
-Wwrite-strings \
-Wcast-qual \
-Wpointer-arith \
-Wstrict-prototypes \
-Wmissing-prototypes \
-Wmissing-declarations \
-Wno-unused-parameter \
-Wno-missing-field-initializers
LIBOBJS = \
cstring.o \
htable.o \
json.o \
util.o \
parsexsd.o \
xml2json.o
all: clean xml2json
Makefile.dep:
gcc -MM *.c > Makefile.dep 2> /dev/null || true
-include Makefile.dep
%.o : %.c
gcc $(CFLAGS) -c -g $<
xml2json: $(LIBOBJS)
gcc $(LIBOBJS) $(LIBXML_LIBS) -o xml2json
check-syntax:
gcc $(CFLAGS) -Wextra -pedantic -fsyntax-only $(CHK_SOURCES)
clean:
rm -f *.o Makefile.dep xml2json
.PHONY: all clean check-syntax