2013-10-19 14:05:42 -04:00
|
|
|
CC=gcc
|
2013-11-06 04:55:38 -05:00
|
|
|
CFLAGS=-Wall -O3
|
2013-11-09 04:05:59 -05:00
|
|
|
PICRIN_LIB=libpicrin.so
|
2013-11-07 04:14:18 -05:00
|
|
|
|
2013-11-09 04:05:59 -05:00
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname -s)), CYGWIN)
|
|
|
|
PICRIN_LIB =cygpicrin.dll
|
2013-11-07 04:14:18 -05:00
|
|
|
endif
|
|
|
|
|
2013-10-30 03:36:21 -04:00
|
|
|
all: build-debug run
|
|
|
|
|
2013-11-07 04:14:18 -05:00
|
|
|
release: CFLAGS += -DDEBUG=0
|
2013-11-04 23:26:38 -05:00
|
|
|
release: build
|
2013-10-30 03:36:21 -04:00
|
|
|
|
2013-11-06 04:55:38 -05:00
|
|
|
build-debug: CFLAGS += -g -DDEBUG=1
|
2013-10-30 03:36:21 -04:00
|
|
|
build-debug: build
|
2013-10-20 05:49:35 -04:00
|
|
|
|
|
|
|
build: build-lib build-main
|
2013-10-09 04:10:58 -04:00
|
|
|
|
2013-10-20 05:44:26 -04:00
|
|
|
build-main:
|
2013-10-30 03:36:21 -04:00
|
|
|
$(CC) $(CFLAGS) tools/main.c -o bin/picrin -I./include -L./lib -lpicrin -lreadline
|
2013-11-07 04:14:18 -05:00
|
|
|
cp lib/$(PICRIN_LIB) bin/
|
2013-10-20 05:44:26 -04:00
|
|
|
|
|
|
|
build-lib:
|
2013-10-11 02:20:53 -04:00
|
|
|
cd src; \
|
2013-10-30 03:36:21 -04:00
|
|
|
yacc -d parse.y; \
|
|
|
|
lex scan.l
|
2013-11-07 10:44:55 -05:00
|
|
|
$(CC) $(CFLAGS) -shared src/*.c -o lib/$(PICRIN_LIB) -I./include -I./extlib -lm
|
2013-10-09 04:10:58 -04:00
|
|
|
|
2013-10-10 03:45:23 -04:00
|
|
|
clean:
|
2013-10-11 02:20:53 -04:00
|
|
|
rm -f src/y.tab.c src/y.tab.h src/lex.yy.c
|
2013-11-09 04:05:59 -05:00
|
|
|
rm -f lib/$(PICRIN_LIB) bin/$(PICRIN_LIB)
|
2013-10-11 02:20:53 -04:00
|
|
|
rm -f bin/picrin
|
2013-10-10 03:45:23 -04:00
|
|
|
|
2013-10-09 04:10:58 -04:00
|
|
|
run:
|
|
|
|
bin/picrin
|
2013-11-04 23:26:38 -05:00
|
|
|
|
|
|
|
tak: build
|
|
|
|
bin/picrin etc/tak.scm
|