Subversion Repositories NedoOS

Rev

Rev 922 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
930 alone 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
 
9
NAME		= wolf3d.com
10
OBJECTS		=
11
SOURCES		= main.asm
12
SPRITES		= wolfspr.bmp wolftex.bmp
13
RESOURCES	=
14
DOCS		=
15
LOCALDIR	= wolf3d
16
INSTALLDIR	?= ../../../release/nedogame
17
BIN_INSTALLDIR	= ${INSTALLDIR}
18
RES_INSTALLDIR	= ${INSTALLDIR}/wolf3d
19
DOC_INSTALLDIR	= ${INSTALLDIR}/doc
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
26
 
27
empty:
28
	@echo 'Usage: make [ TARGET | ACTION-TARGET | all | install | install-doc | clean ]'
29
	@echo 'where ACTION is one of: install clean'
30
	@echo '      TARGET is one of: ${TARGETS}'
31
 
32
# Clear lists
33
DEPS=
34
 
35
# Create directories
36
${sort \
37
${BIN_INSTALLDIR} \
38
${RES_INSTALLDIR} \
39
${DOC_INSTALLDIR} \
40
}:
41
	mkdir -p $@
42
 
43
##########################
44
## Target "executables" ##
45
##########################
46
 
47
EXEC_DEPS=
48
EXEC_BINS=
49
 
50
${eval ${call sjasmplus_odd_rule,${NAME},${SOURCES},,EXEC_DEPS,EXEC_BINS}}
51
 
52
executables: ${EXEC_BINS}
53
 
54
install-executables: executables | ${BIN_INSTALLDIR}
55
	cp ${EXEC_BINS} $|
56
 
57
clean-executables:
58
	${RM} ${EXEC_DEPS} ${EXEC_BINS}
59
 
60
DEPS+=${EXEC_DEPS}
61
 
62
########################
63
## Target "resources" ##
64
########################
65
 
66
RES_BINS=
67
 
68
${foreach f,${SPRITES},\
69
${eval ${call copy_to_dir_rule,${LOCALDIR},${f},RES_BINS}}}
70
 
71
resources: ${RES_BINS} | ${LOCALDIR}
72
 
73
install-resources: resources | ${RES_INSTALLDIR}
74
	cp ${RES_BINS} $|
75
 
76
clean-resources:
77
	${RM} ${RES_BINS}
78
 
79
####################
80
## Common targets ##
81
####################
82
 
83
all: executables resources
84
 
85
install: install-executables install-resources
86
 
87
ifeq "${sort ${DOCS}}" ""
88
install-doc:
89
else
90
install-doc: ${DOCS} | ${DOC_INSTALLDIR}
91
	cp $^ $|
92
endif
93
 
94
clean: clean-executables clean-resources
95
 
96
##################
97
## Dependencies ##
98
##################
99
 
100
ifneq "${sort \
101
${filter empty,${MAKECMDGOALS}} \
102
${filter clean,${MAKECMDGOALS}} \
103
${filter clean-%,${MAKECMDGOALS}} \
104
}" ""
105
else
106
# FIXME: Triggered when multiple targets specified.
107
include ${DEPS}
108
endif