shithub: libmujs

ref: bc6da35e59c59afc599e67ec45b9f67cfcdeca84
dir: /Makefile/

View raw version
SRCS := $(wildcard js*.c utf*.c)
HDRS := $(wildcard js*.h utf.h)
OBJS := $(SRCS:%.c=build/%.o)

CFLAGS = -Wall -g

default: build js

build:
	mkdir -p build

build/%.o : %.c $(HDRS)
	$(CC) -c $< -o $@ $(CFLAGS)

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

js: build/main.o build/libjs.a
	$(CC) -o $@ $^ -lm

tags: $(SRCS) main.c $(HDRS)
	ctags $^

test: js
	python tests/sputniktests/tools/sputnik.py --tests=tests/sputniktests --command ./js --summary

clean:
	rm -f astnames.h opnames.h build/* js

.PHONY: default test clean