printj/bits/Makefile
2018-09-04 01:19:29 -04:00

25 lines
575 B
Makefile

ifndef OUTDIR
OUTDIR=$(PWD)/lib
endif
JSFILES=$(wildcard *.js) $(wildcard *.mjs)
LIBS=$(filter-out $(wildcard [0-9]*_*.js),$(JSFILES))
OUTLIBS=$(patsubst %,$(OUTDIR)/%,$(LIBS))
CPPFLAGS=-P -C -Wno-invalid-pp-token -fdollars-in-identifiers -nostdinc -Wundef -undef $(JSFLAGS)
.PHONY: lib
lib: init $(JSFILES)
for i in $(LIBS); do cpp $(CPPFLAGS) $$i | awk 'BEGIN{last=-3} NF>0 {last=NR} last >= NR-1' > $(OUTDIR)/$$i; done
.PHONY: init
init: 30_ctypes.js
30_ctypes.js: 30_ctypes.njs
node 30_ctypes.njs > 30_ctypes.js
.PHONY: clean
clean:
rm $(OUTLIBS) 30_ctypes.js