-
Notifications
You must be signed in to change notification settings - Fork 140
/
Makefile
49 lines (36 loc) · 1.21 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
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifneq (,$(findstring MINGW,$(uname_S)))
X = .exe
endif
export X
LIBNAME=libpeg-markdown
PROGRAM=markdown$(X)
CFLAGS ?= -Wall -O3 -ansi -D_GNU_SOURCE # -flto for newer GCC versions
OBJS=markdown_parser.o markdown_output.o markdown_lib.o utility_functions.o parsing_functions.o odf.o
PEGDIR=peg-0.1.9
LEG=$(PEGDIR)/leg$(X)
PKG_CONFIG = pkg-config
ALL : $(PROGRAM) $(LIBNAME).a
$(LEG): $(PEGDIR)
CC=gcc make -C $(PEGDIR)
%.o : %.c markdown_peg.h
$(CC) -c `$(PKG_CONFIG) --cflags glib-2.0` $(CFLAGS) -o $@ $<
$(PROGRAM) : markdown.c $(OBJS)
$(CC) `$(PKG_CONFIG) --cflags glib-2.0` $(CFLAGS) -o $@ $< $(OBJS) `$(PKG_CONFIG) --libs glib-2.0`
$(LIBNAME).a: $(OBJS)
ar rcs $(LIBNAME).a $(OBJS)
$(LIBNAME).so: $(OBJS)
$(CC) -shared $(OBJS) -o $(LIBNAME).so
markdown_parser.c : markdown_parser.leg $(LEG) markdown_peg.h parsing_functions.c utility_functions.c
$(LEG) -o $@ $<
.PHONY: clean test
clean:
rm -f markdown_parser.c $(PROGRAM) $(OBJS) $(LIBNAME).*
distclean: clean
make -C $(PEGDIR) clean
\
test: $(PROGRAM)
cd MarkdownTest_1.0.3; \
./MarkdownTest.pl --script=../$(PROGRAM) --tidy
leak-check: $(PROGRAM)
valgrind --leak-check=full ./markdown README