-
Notifications
You must be signed in to change notification settings - Fork 6
/
Makefile
63 lines (46 loc) · 912 Bytes
/
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
63
CC=gcc
CFLAGS=-c -Wall
LDFLAGS=
AWK=awk
# Add your source files here:
LIB_SOURCES=wrx_comp.c wrx_exec.c wrx_prnt.c wrx_free.c wrx_err.c
LIB_OBJECTS=$(LIB_SOURCES:.c=.o)
LIB=libwregex.a
ifeq ($(BUILD),debug)
# Debug
CFLAGS += -O0 -g
LDFLAGS +=
else
# Release mode
CFLAGS += -O2 -DNDEBUG
LDFLAGS += -s
endif
all: test wgrep docs
lib: $(LIB)
debug:
make BUILD=debug
test : test.o $(LIB)
$(CC) $(LDFLAGS) -o $@ $^
wgrep : wgrep.o $(LIB)
$(CC) $(LDFLAGS) -o $@ $^
$(LIB): $(LIB_OBJECTS)
ar rs $@ $^
.c.o:
$(CC) $(CFLAGS) $< -o $@
wrx_comp.o : wregex.h wrxcfg.h
wrx_exec.o : wregex.h wrxcfg.h
wrx_prnt.o : wregex.h wrxcfg.h
wrx_free.o : wregex.h
wrx_err.o : wrxcfg.h
test.o : wregex.h wrx_prnt.h
wgrep.o : wregex.h
docs: manual.html
manual.html: doc.awk wregex.h
$(AWK) -f $^ > $@
.PHONY : clean wipe
clean: wipe
-rm -f $(LIB)
-rm -f test wgrep *.exe
-rm -rf manual.html
wipe:
-rm -f *.o