-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
39 lines (30 loc) · 1.03 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
CC = gcc
SYS := $(shell gcc -dumpmachine)
XMLFILE = contrib/default.xml
ifneq (, $(findstring linux, $(SYS)))
CFLAGS = -I/usr/include/libxml2 -Wformat-truncation=0 -Wno-stringop-truncation
LDFLAGS =
else ifneq (, $(findstring mingw, $(SYS)))
CFLAGS = -I/mingw64/include/libxml2 -Wformat-truncation=0 -Wno-stringop-truncation
LDFLAGS = -L/mingw64/lib
else ifneq (, $(findstring cygwin, $(SYS)))
CFLAGS = -I/usr/include/libxml2 -Wformat-truncation=0 -Wno-stringop-truncation
LDFLAGS =
else ifneq (, $(findstring darwin, $(SYS)))
CFLAGS = -I/usr/local/opt/libxml2/include/libxml2
LDFLAGS = -L/usr/local/opt/libxml2/lib
endif
CFLAGS += -g -O3 -Wall
LDFLAGS += -lpcre2-8 -lxml2
OBJECTS = graphgen.o xmlparser.o
EXEFILE = graphgen
all: $(EXEFILE)
.SUFFIXES: .c .h .o
%.o: %.c %.h Makefile default_xml.inc
$(CC) $(CFLAGS) -o $@ -c $<
$(EXEFILE): $(OBJECTS)
$(CC) -o $(EXEFILE) $(OBJECTS) $(LDFLAGS)
default_xml.inc: $(XMLFILE)
@cat $(XMLFILE) | xxd -i > default_xml.inc
clean:
-rm $(EXEFILE) $(OBJECTS) default_xml.inc