mirror of
https://github.com/ccxvii/mujs.git
synced 2026-09-25 11:07:10 +08:00
Makefile tweaks.
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
build
|
||||
tags
|
||||
tests
|
||||
specs
|
||||
js
|
||||
|
||||
@@ -5,44 +5,44 @@ OBJS := $(SRCS:%.c=build/%.o)
|
||||
CC := clang
|
||||
CFLAGS := -std=c99 -pedantic -Wall -Wextra -Wunreachable-code -Wno-unused-parameter -g
|
||||
|
||||
default: build js re
|
||||
default: build build/js build/jsone build/re
|
||||
|
||||
astnames.h: jsparse.h
|
||||
grep '\(AST\|EXP\|STM\)_' jsparse.h | sed 's/^[ \t]*\(AST_\)\?/"/;s/,.*/",/' | tr A-Z a-z > $@
|
||||
|
||||
opnames.h: jscompile.h
|
||||
grep 'OP_' jscompile.h | sed 's/^[ \t]*OP_/"/;s/,.*/",/' | tr A-Z a-z > $@
|
||||
|
||||
one.c: $(SRCS)
|
||||
ls $(SRCS) | awk '{print "#include \""$$1"\""}' > $@
|
||||
|
||||
jsdump.c: astnames.h opnames.h
|
||||
|
||||
build:
|
||||
mkdir -p build
|
||||
|
||||
build/%.o : %.c $(HDRS)
|
||||
build/%.o: %.c $(HDRS)
|
||||
$(CC) $(CFLAGS) -o $@ -c $<
|
||||
|
||||
build/libjs.a: $(OBJS)
|
||||
ar cru $@ $^
|
||||
|
||||
astnames.h : jsparse.h
|
||||
grep '\(AST\|EXP\|STM\)_' jsparse.h | sed 's/^[ \t]*\(AST_\)\?/"/;s/,.*/",/' | tr A-Z a-z > $@
|
||||
|
||||
opnames.h : jscompile.h
|
||||
grep 'OP_' jscompile.h | sed 's/^[ \t]*OP_/"/;s/,.*/",/' | tr A-Z a-z > $@
|
||||
|
||||
jsdump.c : astnames.h opnames.h
|
||||
|
||||
one.c : $(SRCS)
|
||||
ls $(SRCS) | awk '{print "#include \""$$1"\""}' > $@
|
||||
|
||||
js: build/main.o build/libjs.a
|
||||
build/js: build/main.o build/libjs.a
|
||||
$(CC) -o $@ $^ -lm
|
||||
|
||||
jsone: build/main.o build/one.o
|
||||
build/jsone: build/main.o build/one.o
|
||||
$(CC) -o $@ $^ -lm
|
||||
|
||||
re: regex.c utf.c utftype.c
|
||||
build/re: regex.c utf.c utftype.c
|
||||
$(CC) $(CFLAGS) -DTEST -o $@ $^
|
||||
|
||||
tags: $(SRCS) main.c $(HDRS)
|
||||
ctags $^
|
||||
|
||||
test: js
|
||||
python tests/sputniktests/tools/sputnik.py --tests=tests/sputniktests --command ./js --summary
|
||||
test: build/js
|
||||
python tests/sputniktests/tools/sputnik.py --tests=tests/sputniktests --command ./build/js --summary
|
||||
|
||||
clean:
|
||||
rm -f astnames.h opnames.h one.c build/* js
|
||||
rm -f astnames.h opnames.h one.c build/*
|
||||
|
||||
.PHONY: default test clean
|
||||
|
||||
Reference in New Issue
Block a user