PageRenderTime 31ms CodeModel.GetById 14ms app.highlight 11ms RepoModel.GetById 2ms app.codeStats 0ms

/Makefile

http://github.com/feyeleanor/RubyGoLightly
Makefile | 78 lines | 56 code | 20 blank | 2 comment | 5 complexity | 6488477472d08ecc77d94514aaf53a24 MD5 | raw file
 1CC = gcc
 2CFLAGS = -std=c99 -Wall -Wextra -D_XOPEN_SOURCE -DDEBUG -g ${OPTIMIZE}
 3INCS = -Ivm -Ivendor/gc/include -Ivendor/pcre -Ivendor
 4LIBS = ${GC} ${PCRE}
 5GC = vendor/gc/.libs/libgc.a
 6PCRE = vendor/pcre/.libs/libpcre.a
 7LEG = vendor/peg/leg
 8FREEGETOPT = vendor/freegetopt/getopt.o
 9
10# Optimizations
11ifndef DEV
12OPTIMIZE = -O3 -funroll-loops -fomit-frame-pointer -fstrict-aliasing
13endif
14
15ifdef COMPAT
16CFLAGS += -pedantic -DTR_COMPAT_MODE
17endif
18
19# Plateform specific libs
20SYS = $(shell uname -s)
21ifneq ($(SYS),Linux)
22LIBS += ${FREEGETOPT}
23endif
24
25SRC = vm/string.c vm/number.c vm/range.c vm/regexp.c vm/primitive.c vm/proc.c vm/array.c vm/hash.c vm/class.c vm/error.c vm/kernel.c vm/object.c vm/block.c vm/compiler.c vm/grammar.c vm/vm.c vm/tr.c
26OBJ = ${SRC:.c=.o}
27OBJ_MIN = vm/tr.o
28
29all: tinyrb
30
31.c.o:
32	@echo "   cc $<"
33	@${CC} -c ${CFLAGS} ${INCS} -o $@ $<
34
35tinyrb: ${LIBS} ${OBJ}
36	@echo " link tinyrb"
37	@${CC} ${CFLAGS} ${OBJ_POTION} ${OBJ} ${LIBS} ${PKG_LIBS} -o tinyrb
38
39vm/grammar.c: ${LEG} vm/grammar.leg
40	@echo "  leg vm/grammar.leg"
41	@${LEG} -ovm/grammar.c vm/grammar.leg
42
43vm/vm.o: vm/call.h
44
45${FREEGETOPT}:
46
47${LEG}:
48	@echo " make peg/leg"
49	@cd vendor/peg && make -s
50
51${GC}:
52	@echo " make gc"
53	@cd vendor/gc && ./configure --disable-threads -q && make -s
54
55${PCRE}:
56	@echo " make pcre"
57	@cd vendor/pcre && ./configure -q && make -s
58
59test: tinyrb
60	@ruby test/runner
61
62sloc: clean
63	@cp vm/grammar.leg vm/grammar.leg.c
64	@sloccount vm lib
65	@rm vm/grammar.leg.c
66
67size: clean
68	@ruby -e 'puts "%0.2fK" % (Dir["vm/*.{c,leg,h}"].inject(0) {|s,f| s += File.size(f)} / 1024.0)'
69
70clean:
71	$(RM) vm/*.o vm/grammar.c
72
73rebuild: clean tinyrb
74
75site:
76	scp site/* macournoyer@code.macournoyer.com:code.macournoyer.com/tinyrb
77
78.PHONY: all sloc size clean rebuild test site