NAME = jimmy LIBS = read emit util BUILD = $(PWD)/build SRC = $(PWD)/src CSC = /usr/bin/csc CSI = /usr/bin/csi CSC_OPTIONS = \ -setup-mode \ -host \ -D compiling-extension \ -emit-all-import-libraries \ -dynamic \ -regenerate-import-libraries \ -I $(PWD) \ -C -I$(PWD) CSC_OPTIONS_EXTRA = \ -X utf8 \ -X module-declarations ## Library dependency graph # here's a convenience macro lib = $(BUILD)/$(NAME).$(1).so # and another src = $(SRC)/$(1).scm LIBS_ = $(foreach l,$(LIBS),$(call lib,$(l))) ## Phonies .PHONY: build test clean build: $(LIBS_) -mv *.import.scm build/ test: build cd $(BUILD) && \ $(CSI) -setup-mode -s tests/run.scm $(NAME) clean: -rm -rf $(BUILD) install: chicken-install -s uninstall: chicken-uninstall -s # Scm -> So $(BUILD)/$(NAME).%.so: src/%.scm mkdir -p "$(dir $@)" $(CSC) $(CSC_OPTIONS) $(CSC_OPTIONS_EXTRA) $< -o $@ # Libraries! $(call lib,util): $(call src,util) $(call lib,read): $(call src,read) $(call lib,util) $(call lib,emit): $(call src,emit) $(call lib,util) # Program!