blob: 0c962e6cb765548778813cb3a917a48b10dc74c9 (
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
DESTDIR=
LIBDIR=/usr/lib64
BINDIR=/usr/bin
PYGLIBDIR=$(DESTDIR)/$(LIBDIR)/pyg
PYGBINDIR=$(DESTDIR)/$(BINDIR)
CC=gcc
AR=ar
FLEX=flex
YACC=bison
CCOPTS=-Wall -ansi
CCSHARED=-fPIC
AROPTS=-rs
FLEXOPTS=
YACCOPTS=-d
#CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
CPPFLAGS:=
# Add more -I and -D options here
## CFLAGS=$(OPT) -I$(INCLUDEPY) -I$(EXECINCLUDEPY) $(DEFS) $(shell dpkg-buildflags --get CFLAGS)
OPTFLAGS=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4
OPTFLAGS+=-grecord-gcc-switches -m64 -mtune=generic
CFLAGS=$(OPTFLAGS)
CXXFLAGS:=$(OPTFLAGS)
OPTLDFLAGS=-Wl,-z,relro
#LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
LDFLAGS:=$(OPTLDFLAGS)
SRCDIR=.
BINDIR=.
OBJFILE=structs.o commands.tab.o lex.yy.o
all: archive bin
# archive file for python module
archive: structs bison flex macro.h structs.h commands.tab.h
mkdir -p $(PYGLIBDIR)
$(AR) $(AROPTS) $(PYGLIBDIR)/wlp.a $(OBJFILE)
# binary (executable) file for testing
executable: bin
bin: structs bison flex macro.h structs.h commands.tab.h
$(CC) $(CCSHARED) $(CCOPTS) $(OBJFILE) \
yytest.c $(PYGLIBDIR)/libfl.a -o ./yytest
flex:
$(FLEX) $(FLEXOPTS) commands.l
$(CC) $(CCSHARED) -c lex.yy.c -o lex.yy.o
bison:
$(YACC) $(YACCOPTS) -d commands.y -b commands
$(CC) $(CCSHARED) -c commands.tab.c -o commands.tab.o
structs:
$(CC) $(CCSHARED) $(CCOPTS) -c structs.c -o structs.o
clean:
rm -f $(OBJFILE) lex.yy.c commands.tab.h commands.tab.c wlp.a yytest
|