Rev 930 | Details | Compare with Previous | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
1548 | salex | 1 | # Supported environments: |
2 | # GNU/Linux. |
||
3 | # |
||
4 | # Tools used: |
||
5 | # GNU core utilities, tools/aspp, tools/sjasmplus. |
||
6 | |||
7 | include ../_sdk/common.mk |
||
8 | |||
930 | alone | 9 | NAME = player.com |
10 | OBJECTS = |
||
11 | SOURCES = player.asm |
||
12 | RESOURCES = |
||
13 | DOCS = |
||
1548 | salex | 14 | INSTALLDIR ?= ../../release |
15 | BIN_INSTALLDIR = ${INSTALLDIR}/bin |
||
16 | RES_INSTALLDIR = ${INSTALLDIR}/bin |
||
17 | DOC_INSTALLDIR = ${INSTALLDIR}/doc |
||
18 | DEPEXT = d |
||
930 | alone | 19 | |
1548 | salex | 20 | # All targets |
21 | TARGETS=executables resources |
||
22 | .PHONY: empty ${foreach t,${TARGETS},${t} install-${t} clean-${t}} all install install-doc clean |
||
23 | |||
24 | .DEFAULT_GOAL=all |
||
25 | |||
26 | empty: |
||
27 | @echo 'Usage: make [ TARGET | ACTION-TARGET | all | install | install-doc | clean ]' |
||
28 | @echo 'where ACTION is one of: install clean' |
||
29 | @echo ' TARGET is one of: ${TARGETS}' |
||
30 | |||
31 | # Clear lists |
||
32 | DEPS= |
||
33 | |||
34 | # Create directories |
||
35 | ${sort \ |
||
36 | ${BIN_INSTALLDIR} \ |
||
37 | ${RES_INSTALLDIR} \ |
||
38 | ${DOC_INSTALLDIR} \ |
||
39 | }: |
||
40 | mkdir -p $@ |
||
41 | |||
42 | ########################## |
||
43 | ## Target "executables" ## |
||
44 | ########################## |
||
45 | |||
46 | EXEC_DEPS= |
||
47 | EXEC_BINS= |
||
48 | |||
49 | ${eval ${call sjasmplus_odd_rule,${NAME},${SOURCES},,EXEC_DEPS,EXEC_BINS}} |
||
50 | |||
51 | executables: ${EXEC_BINS} |
||
52 | |||
53 | install-executables: executables | ${BIN_INSTALLDIR} |
||
54 | cp ${EXEC_BINS} $| |
||
55 | |||
56 | clean-executables: |
||
57 | ${RM} ${EXEC_DEPS} ${EXEC_BINS} |
||
58 | |||
59 | DEPS+=${EXEC_DEPS} |
||
60 | |||
61 | ######################## |
||
62 | ## Target "resources" ## |
||
63 | ######################## |
||
64 | |||
65 | resources: ${RESOURCES} |
||
66 | |||
67 | install-resources: resources | ${RES_INSTALLDIR} |
||
68 | ifneq "${sort ${RESOURCES}}" "" |
||
69 | cp ${RESOURCES} $| |
||
70 | endif |
||
71 | |||
72 | clean-resources: |
||
73 | |||
74 | #################### |
||
75 | ## Common targets ## |
||
76 | #################### |
||
77 | |||
78 | all: executables resources |
||
79 | |||
80 | install: install-executables install-resources |
||
81 | |||
82 | ifeq "${sort ${DOCS}}" "" |
||
83 | install-doc: |
||
84 | else |
||
85 | install-doc: ${DOCS} | ${DOC_INSTALLDIR} |
||
86 | cp $^ $| |
||
87 | endif |
||
88 | |||
89 | clean: clean-executables clean-resources |
||
90 | |||
91 | ################## |
||
92 | ## Dependencies ## |
||
93 | ################## |
||
94 | |||
95 | ifneq "${sort \ |
||
96 | ${filter empty,${MAKECMDGOALS}} \ |
||
97 | ${filter clean,${MAKECMDGOALS}} \ |
||
98 | ${filter clean-%,${MAKECMDGOALS}} \ |
||
99 | }" "" |
||
100 | else |
||
101 | # FIXME: Triggered when multiple targets specified. |
||
102 | include ${DEPS} |
||
103 | endif |