blob: b1fafd2de940927a769657e3b91542f2e30fa6e7 (
plain) (
blame)
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
|
PROJ=libcmd
CC=g++
CFLAGS=-Wwrite-strings -fpermissive -fno-rtti -fno-exceptions -fno-unwind-tables
LDFLAGS=
RAGEL=ragel
DOT=dot
SOURCE=cmd cmd_parse
OBJECTS=$(SOURCE:=.o)
SOURCES=$(SOURCE:=.c)
%.o: %.c
$(CC) $(CFLAGS) -c $<
make: dynamic static object
dynamic: CFLAGS+=-fPIC
dynamic: clean $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -shared -o $(PROJ).so
static: clean $(OBJECTS)
ar rcs $(PROJ).a $(OBJECTS)
object: clean $(OBJECTS)
ld -r $(OBJECTS) -o $(PROJ).o
ragel:
$(RAGEL) cmd_parse.ragel
cli:
$(CC) $(CFLAGS) -L./ -I./ -lcmd ./test/cmd_cli.c -o ./cmd_cli
pdf:
$(RAGEL) -V cmd_parse.ragel -o cmd_parse.dot
$(DOT) -Tpdf cmd_parse.dot -o cmd_parse.pdf
leak:
valgrind --leak-check=full --track-origins=yes --log-file=log.txt ./cmd_cli
clean:
rm -f cmd_cli
rm -rf *.so *.o *.a *.dot *.pdf
|