2013-10-19 14:05:42 -04:00
|
|
|
CC=gcc
|
2014-02-01 04:46:50 -05:00
|
|
|
CFLAGS=-Wall -Wextra -std=c99
|
2013-11-07 04:14:18 -05:00
|
|
|
|
2013-11-09 04:05:59 -05:00
|
|
|
ifeq ($(findstring CYGWIN,$(shell uname -s)), CYGWIN)
|
2014-02-01 21:16:33 -05:00
|
|
|
XFILE_LIB=cygxfile.dll
|
2013-11-17 04:04:38 -05:00
|
|
|
PICRIN_LIB=cygpicrin.dll
|
|
|
|
else
|
2014-02-01 21:16:33 -05:00
|
|
|
XFILE_LIB=libxfile.so
|
2013-11-17 04:04:38 -05:00
|
|
|
PICRIN_LIB=libpicrin.so
|
2013-11-07 04:14:18 -05:00
|
|
|
endif
|
|
|
|
|
2014-01-09 01:30:44 -05:00
|
|
|
all: deps release
|
|
|
|
|
|
|
|
deps:
|
|
|
|
git submodule update --init
|
2014-02-01 21:16:33 -05:00
|
|
|
$(CC) $(CFLAGS) -shared -fPIC extlib/xfile/*.c -o lib/$(XFILE_LIB) -I./extlib/xfile
|
2013-10-30 03:36:21 -04:00
|
|
|
|
2013-11-17 00:39:08 -05:00
|
|
|
release: CFLAGS += -DDEBUG=0 -O3
|
2013-11-04 23:26:38 -05:00
|
|
|
release: build
|
2013-10-30 03:36:21 -04:00
|
|
|
|
2013-11-28 04:49:51 -05:00
|
|
|
debug: CFLAGS += -g -DDEBUG=1 -O0
|
|
|
|
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:
|
2014-02-01 21:23:04 -05:00
|
|
|
$(CC) $(CFLAGS) tools/main.c src/*.c -o bin/picrin -I./include -I./extlib -L./lib -lreadline -lm -lxfile
|
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; \
|
2013-11-18 06:24:09 -05:00
|
|
|
flex scan.l
|
2014-02-01 21:16:33 -05:00
|
|
|
$(CC) $(CFLAGS) -shared -fPIC src/*.c -o lib/$(PICRIN_LIB) -I./include -I./extlib -L./lib -lm -lxfile
|
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-17 04:04:38 -05:00
|
|
|
rm -f lib/$(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
|
|
|
|
2013-11-17 04:04:38 -05:00
|
|
|
tak: release
|
2013-11-04 23:26:38 -05:00
|
|
|
bin/picrin etc/tak.scm
|
2013-12-05 03:21:52 -05:00
|
|
|
|
2014-01-17 23:06:56 -05:00
|
|
|
lines: clean
|
|
|
|
wc -l `find . -name "*.[chyl]"`
|
|
|
|
|
2013-12-05 03:21:52 -05:00
|
|
|
no-act:
|
2013-12-10 11:06:07 -05:00
|
|
|
bin/picrin -e '' > /dev/null
|