NAME = jimmy CSC = /usr/bin/csc CSI = /usr/bin/csi CSC_OPTIONS = \ -host \ -D compiling-extension \ -emit-all-import-libraries \ -dynamic \ -regenerate-import-libraries \ -setup-mode \ -I $(PWD) \ -C -I$(PWD) \ CSC_OPTIONS_EXTRA = \ -X utf8 \ -X module-declarations BUILD = $(PWD)/build .PHONY: all test build: $(patsubst src/%.scm,$(BUILD)/%.so,$(wildcard src/*.scm)) test: build $(CSI) -s $(PWD)/tests/run.scm $(NAME) # Program! # Libraries! $(BUILD)/%.so: src/%.scm mkdir -p "$(dir $@)" $(CSC) $(CSC_OPTIONS) $(CSC_OPTIONS_EXTRA) $< -o $@ ## Library dependency graph # here's a convenience macro lib = $(BUILD)/$(NAME).$(1).so $(call lib,read): $(call lib,util) $(call lib,emit): $(call lib,util)