Rev 922 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log
| Rev 922 | Rev 930 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | # Supported environments: |
1 | # Supported environments: |
| 2 | # GNU/Linux |
2 | # GNU/Linux. |
| - | 3 | # |
|
| 3 | # Windows NT |
4 | # Tools used: |
| - | 5 | # GNU core utilities, tools/aspp, tools/sjasmplus, _sdk/nedores.bin. |
|
| 4 | 6 | ||
| 5 | include ../../_sdk/common.mk |
7 | include ../../_sdk/common.mk |
| 6 | 8 | ||
| 7 | # no trailing "/" |
9 | NAME = tank.com |
| - | 10 | OBJECTS = |
|
| - | 11 | SOURCES = main.asm |
|
| - | 12 | SPRITES = sprset.bmp tileset.bmp |
|
| - | 13 | RESOURCES = |
|
| - | 14 | DOCS = |
|
| - | 15 | INSTALLDIR ?= ../../../release/nedogame |
|
| - | 16 | BIN_INSTALLDIR = ${INSTALLDIR} |
|
| - | 17 | RES_INSTALLDIR = ${INSTALLDIR} |
|
| 8 | INSTALLDIR := $(INSTALLDIR)nedogame |
18 | DOC_INSTALLDIR = ${INSTALLDIR}/doc |
| - | 19 | NEDORES = ../../_sdk/nedores.bin |
|
| - | 20 | ||
| - | 21 | # All targets |
|
| - | 22 | TARGETS=executables resources |
|
| - | 23 | .PHONY: empty ${foreach t,${TARGETS},${t} install-${t} clean-${t}} all install install-doc clean |
|
| - | 24 | ||
| - | 25 | .DEFAULT_GOAL=all |
|
| 9 | 26 | ||
| - | 27 | empty: |
|
| - | 28 | @echo 'Usage: make [ TARGET | ACTION-TARGET | all | install | install-doc | clean ]' |
|
| 10 | .PHONY: install clean |
29 | @echo 'where ACTION is one of: install clean' |
| - | 30 | @echo ' TARGET is one of: ${TARGETS}' |
|
| 11 | 31 | ||
| 12 | tank.com: main.asm \ |
32 | # Clear lists |
| - | 33 | DEPS= |
|
| - | 34 | ||
| 13 | ../../_sdk/sys_h.asm \ |
35 | # Create directories |
| - | 36 | ${sort \ |
|
| 14 | ../../_sdk/sysdefs.asm \ |
37 | ${BIN_INSTALLDIR} \ |
| 15 | collisio.asm \ |
38 | ${RES_INSTALLDIR} \ |
| 16 | input.asm \ |
39 | ${DOC_INSTALLDIR} \ |
| - | 40 | }: |
|
| 17 | macro.asm \ |
41 | mkdir -p $@ |
| - | 42 | ||
| - | 43 | ########################## |
|
| - | 44 | ## Target "executables" ## |
|
| - | 45 | ########################## |
|
| - | 46 | ||
| 18 | math.asm \ |
47 | EXEC_DEPS= |
| 19 | sprite.asm \ |
48 | EXEC_ASTS= |
| 20 | sprset.ast \ |
49 | EXEC_BINS= |
| - | 50 | ||
| 21 | tankdata.asm \ |
51 | define nedores_rule = |
| - | 52 | # File order does matter! |
|
| 22 | tankgfx.asm \ |
53 | ${1}: ${2} ${3} |
| - | 54 | ${NEDORES} $$^ $$@ |
|
| 23 | tileset.ast \ |
55 | EXEC_ASTS+=${1} |
| 24 | zx.fnt |
56 | endef |
| - | 57 | ||
| - | 58 | ${foreach f,${filter %.bmp,${SPRITES}},\ |
|
| - | 59 | ${eval ${call nedores_rule,${patsubst %.bmp,%.ast,${f}},${f},${patsubst %.bmp,%.da,${f}}}}} |
|
| - | 60 | ||
| - | 61 | ${eval ${call sjasmplus_odd_rule,${NAME},${SOURCES},,EXEC_DEPS,EXEC_BINS}} |
|
| - | 62 | ||
| - | 63 | executables: ${EXEC_BINS} |
|
| - | 64 | ||
| - | 65 | install-executables: executables | ${BIN_INSTALLDIR} |
|
| 25 | $(AS) $(AFLAGS) $< |
66 | cp ${EXEC_BINS} $| |
| 26 | 67 | ||
| - | 68 | clean-executables: |
|
| - | 69 | ${RM} ${EXEC_DEPS} ${EXEC_ASTS} ${EXEC_BINS} |
|
| - | 70 | ||
| - | 71 | DEPS+=${EXEC_DEPS} |
|
| - | 72 | ||
| - | 73 | ######################## |
|
| 27 | sprset.ast: sprset.bmp sprset.da |
74 | ## Target "resources" ## |
| - | 75 | ######################## |
|
| - | 76 | ||
| 28 | $(NEDORES) $^ $@ |
77 | resources: ${RESOURCES} |
| 29 | 78 | ||
| - | 79 | install-resources: resources | ${RES_INSTALLDIR} |
|
| 30 | tileset.ast: tileset.bmp tileset.da |
80 | ifneq "${sort ${RESOURCES}}" "" |
| 31 | $(NEDORES) $^ $@ |
81 | cp ${RESOURCES} $| |
| - | 82 | endif |
|
| 32 | 83 | ||
| 33 | install: \ |
84 | clean-resources: |
| - | 85 | ||
| - | 86 | #################### |
|
| 34 | $(INSTALLDIR) \ |
87 | ## Common targets ## |
| - | 88 | #################### |
|
| - | 89 | ||
| 35 | $(INSTALLDIR)/tank.com |
90 | all: executables resources |
| - | 91 | ||
| - | 92 | install: install-executables install-resources |
|
| 36 | 93 | ||
| - | 94 | ifeq "${sort ${DOCS}}" "" |
|
| 37 | $(INSTALLDIR): |
95 | install-doc: |
| - | 96 | else |
|
| - | 97 | install-doc: ${DOCS} | ${DOC_INSTALLDIR} |
|
| 38 | $(MKDIR) $@ |
98 | cp $^ $| |
| - | 99 | endif |
|
| 39 | 100 | ||
| 40 | $(INSTALLDIR)/tank.com: tank.com |
101 | clean: clean-executables clean-resources |
| - | 102 | ||
| - | 103 | ################## |
|
| 41 | $(CP) $< $@ |
104 | ## Dependencies ## |
| - | 105 | ################## |
|
| 42 | 106 | ||
| - | 107 | ifneq "${sort \ |
|
| - | 108 | ${filter empty,${MAKECMDGOALS}} \ |
|
| - | 109 | ${filter clean,${MAKECMDGOALS}} \ |
|
| - | 110 | ${filter clean-%,${MAKECMDGOALS}} \ |
|
| - | 111 | }" "" |
|
| 43 | clean: |
112 | else |
| 44 | $(RM) sprset.ast tank.com tileset.ast |
113 | # FIXME: Triggered when multiple targets specified. |
| - | 114 | include ${DEPS} |
|
| - | 115 | endif |
|