047c458f |
1 | # Universal Makefile for X16 code |
325547c4 |
2 | |
325547c4 |
3 | |
047c458f |
4 | ASM_CMD=$(H316)/bin/asm |
5 | FRTN_CMD=$(H316)/bin/frtn |
6 | SRC_DIR=src |
7 | BUILD_DIR=build |
325547c4 |
8 | |
047c458f |
9 | PROGRAMS=$(foreach n, $(wildcard $(SRC_DIR)/*.f $(SRC_DIR)/*.asm),$(notdir $(basename $(n)))) |
325547c4 |
10 | |
047c458f |
11 | #$(PROGRAMS):%:/$(BUILD_DIR)/%.f |
325547c4 |
12 | |
047c458f |
13 | default: $(foreach prog, $(PROGRAMS),$(BUILD_DIR)/$(prog).obj) |
325547c4 |
14 | |
047c458f |
15 | $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.f |
16 | @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi |
17 | $(FRTN_CMD) $< && mv $(notdir $(basename $<)).obj $(BUILD_DIR) |
325547c4 |
18 | |
047c458f |
19 | $(BUILD_DIR)/%.obj:$(SRC_DIR)/%.asm |
20 | @if [ ! -d $(BUILD_DIR) ]; then mkdir $(BUILD_DIR); fi |
21 | $(ASM_CMD) $< && mv $(notdir $(basename $<)).obj $(BUILD_DIR) |
325547c4 |
22 | |
047c458f |
23 | clean : |
24 | @rm -rf *.obj $(BUILD_DIR)/ *.lst *.go *.par |
325547c4 |
25 | |
047c458f |
26 | .PHONY: default clean |