-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·72 lines (46 loc) · 1.77 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
LIBFLEXPATH = submodules/libflex
CONFIGPATH = submodules/libflex
include $(CONFIGPATH)/config.$(OSTYPE)-$(MACHTYPE).clang
include config.$(OSTYPE)-$(MACHTYPE).clang
CCFLAGS = $(PLATFORM_DBGFLAGS) $(PLATFORM_CFLAGS) $(PLATFORM_DFLAGS) $(PLATFORM_OPTFLAGS)
#
# We pass in linker flags to explicitly request a large stack since for grammars with high nesting depth
# we can run out of stack space.
#
LDFLAGS = $(PLATFORM_DBGFLAGS) -lm $(PLATFORM_LFLAGS) #-Wl,-stack_size -Wl,0xF000000
FFI2CODE_L10N = EN
CCFLAGS += -DFFI2CODE_L10N="\"$(FFI2CODE_L10N)\"" -DFFI2CODE_L10N_EN
TARGET = ffi2code-$(OSTYPE)-$(FFI2CODE_L10N)
WFLAGS = -Wall #-Werror
INCDIRS = -I. -I$(LIBFLEXPATH)
OBJS =\
ffi2code.$(OBJECTEXTENSION)\
HEADERS =\
version.h\
#
# Executables
#
all: $(OBJS)
$(LD) -L. -L$(LIBFLEXPATH) $(LDFLAGS) $(OBJS) -lflex-$(OSTYPE) -o $(TARGET)
#
# Objects
#
%.$(OBJECTEXTENSION): %.c $(HEADERS) Makefile
# $(SPLINT) $(FLEXFLAGS) $(INCDIRS) $<
# $(LCLINT) $(FLEXFLAGS) $(INCDIRS) $<
$(CC) $(FLEXFLAGS) $(INCDIRS) $(CCFLAGS) $(WFLAGS) $(OPTFLAGS) -c --analyze $<
$(CC) $(FLEXFLAGS) $(INCDIRS) $(CCFLAGS) $(WFLAGS) $(OPTFLAGS) -c $<
version.h: Makefile ffi2code.c
echo 'char kFFI2CODE_VERSION[] = "0.1-alpha-'`git rev-list --count HEAD`' ('`git rev-parse HEAD`') (build '`date '+%m-%d-%Y-%H:%M'`-`whoami`@`hostname -s`-`uname -s`-`uname -r`-`uname -m`\)\"\; > version.h
#
# Debug and Documentation
#
# Need --dsymutil=yes flag to valgrind to get line numbers in error messages
debug: all
valgrind --dsymutil=yes --leak-check=yes ./$(TARGET) EXAMPLES/test.ffi >& debug.valgrind.log; sam debug.valgrind.log &
scan: clean
scan-build --use-cc=$(CC) -k -V make -j4
README.sloccount: clean
sloccount *.c *.h *.y > README.sloccount
clean:
rm -f $(OBJS) $(TARGET) version.h