haberman / gazelle

A system for creating fast, reusable parsers

This URL has Read+Write access

gazelle / Makefile
100644 59 lines (45 sloc) 1.619 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
53
54
55
56
57
58
59
 
# Change these if necessary.
export CC=gcc
export AR=ar
export CFLAGS=-Wall -g -O6 -std=c99
ifeq ($(shell uname), Darwin)
  export LUA_INCLUDE=-I/usr/include/lua5.1
  export LUA_LINK=-L/usr/local/lib -llua
else
  export LUA_INCLUDE=`pkg-config --silence-errors --cflags lua || pkg-config --cflags lua5.1`
  export LUA_LINK=`pkg-config --silence-errors --libs lua || pkg-config --libs lua5.1`
endif
 
SUBDIRS=runtime lang_ext utilities
ALLSUBDIRS=$(SUBDIRS) docs
TARGETS=all clean docs doc default install runtime test utilities
PREFIX=/usr/local
 
.PHONY: $(TARGETS)
 
default: lua_path gzlc
@for dir in $(SUBDIRS) ; do $(MAKE) -w -C $$dir $@ || break ; done
 
runtime:
$(MAKE) -w -C runtime
 
utilities: runtime
$(MAKE) -w -C utilities
 
all: lua_path doc
@for dir in $(ALLSUBDIRS) ; do $(MAKE) -w -C $$dir $@ || break ; done
 
doc: docs
docs:
@$(MAKE) -w -C docs
 
clean:
rm -f lua_path *.dot *.png docs/manual.html docs/*.png gzlc gzlc.out
@for dir in $(ALLSUBDIRS) ; do make -w -C $$dir $@; done
 
lua_path: Makefile
echo "export LUA_PATH=`pwd`/compiler/?.lua\\;`pwd`/sketches/?.lua\\;`pwd`/tests/?.lua" > lua_path
echo export LUA_CPATH=`pwd`/lang_ext/lua/?.so >> lua_path
 
gzlc: utilities
lua utilities/luac.lua compiler/gzlc -L compiler/*.lua compiler/bootstrap/*.lua sketches/pp.lua sketches/dump_to_html.lua
./utilities/srlua-glue ./utilities/srlua luac.out gzlc
chmod a+x gzlc
 
install: gzlc runtime/libgazelle.a
mkdir -p $(PREFIX)/bin
cp gzlc $(PREFIX)/bin
cp utilities/gzlparse $(PREFIX)/bin
mkdir -p $(PREFIX)/include
cp -R runtime/include/gazelle $(PREFIX)/include
 
test:
lua tests/run_tests.lua