forked from hhatto/peg-rst
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
52 lines (37 loc) · 1.27 KB
/
Makefile
File metadata and controls
52 lines (37 loc) · 1.27 KB
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
.PHONY: test
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
ifneq (,$(findstring MINGW,$(uname_S)))
X = .exe
endif
export X
LIBNAME=librst
PROGRAM=rst$(X)
CFLAGS ?= -Wall -O3 -ansi -D_GNU_SOURCE # -flto for newer GCC versions
OBJS=rst_parser.o rst_output.o rst_lib.o utility_functions.o parsing_functions.o odf.o
PEGDIR=peg-0.1.18
LEG=$(PEGDIR)/leg$(X)
PKG_CONFIG = pkg-config
ALL: $(PROGRAM) $(LIBNAME).a
$(LEG): $(PEGDIR)
CC=gcc make -C $(PEGDIR)
%.o: %.c rst_peg.h
$(CC) -c `$(PKG_CONFIG) --cflags glib-2.0` $(CFLAGS) -o $@ $<
$(PROGRAM): rst.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
rst_parser.c: rst_parser.leg $(LEG) rst_peg.h parsing_functions.c utility_functions.c
$(LEG) -o $@ $<
.PHONY: clean test
clean:
rm -f rst_parser.c $(PROGRAM) $(OBJS) $(LIBNAME).*
rm -f test/*.html
distclean: clean
make -C $(PEGDIR) spotless clean
leak-check: $(PROGRAM)
valgrind --leak-check=full ./$(PROGRAM) README.rst
test: $(PROGRAM)
./$(PROGRAM) test/goldenmaster/peg-rst.readme.rst > test/tmp.peg-rst.readme.html
diff -u test/tmp.peg-rst.readme.html test/goldenmaster/peg-rst.readme.html