-
Notifications
You must be signed in to change notification settings - Fork 5
/
mac_setup_resources.mk
104 lines (82 loc) · 2.37 KB
/
mac_setup_resources.mk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# targets:
# resinstall
# datainstall
# shipinstall
#
# required variables:
# TORCS_BASE - torcs source dir
# MAKE_DEFAULT - this file
# datadir - destination dir
#
# example:
# cd torcs-1.3.1
# make resinstall TORCS_BASE=$PWD MAKE_DEFAULT=$PWD/../mac_setup_resources.mk \
# datadir=$PWD/../../RES
#
# - CL
ifndef TORCS_BASE
error:
@echo "TORCS_BASE should be defined"
@exit 1
endif
INSTALL = /usr/bin/install -c
INSTALL_DATA = ${INSTALL} -m 644
mkinstalldirs = $(SHELL) $(TORCS_BASE)/mkinstalldirs
INSTDATABASE = ${DESTDIR}${datadir}
INSTVARBASE = ${DESTDIR}${datadir}
define recursedirs
for Dir in $$RecurseDirs ;\
do ${MAKE} -C $$Dir $$RecurseFlags TORCS_BASE=${TORCS_BASE} MAKE_DEFAULT=${MAKE_DEFAULT}; \
if [ $$? != 0 ]; then exit 1; fi ; \
done
endef
# Recursive targets
.PHONY: datainstall installdata installdatadirs makedatadir shipinstall installship installshipmkdir instshipdirs installshipdirs
resinstall: datainstall shipinstall
datainstall: installdatadirs installdata
installdata: makedatadir $(patsubst %, ${INSTDATABASE}/${DATADIR}/%, $(DATA))
makedatadir:
@D=`pwd` ; \
createdir="${INSTDATABASE}/${DATADIR}" ; \
$(mkinstalldirs) $$createdir
$(patsubst %, ${INSTDATABASE}/${DATADIR}/%, $(DATA)) : ${INSTDATABASE}/${DATADIR}/% : %
$(INSTALL_DATA) $< $@
instdatadirs:
@RecurseDirs="${DATASUBDIRS}" ; \
RecurseFlags="install" ; \
${recursedirs}
installdatadirs:
@if [ -n "${DATASUBDIRS}" ] ; \
then R=`for I in ${DATASUBDIRS} ; \
do echo $$I ;\
done | sort -u` ; \
RecurseDirs="$$R" ; \
RecurseFlags="datainstall" ; \
${recursedirs} ; \
fi
shipinstall: installshipdirs installship installshipmkdir
installship: makeshipdir $(patsubst %, ${INSTDATABASE}/${SHIPDIR}/%, $(SHIP))
makeshipdir:
@D=`pwd` ; \
createdir="${INSTDATABASE}/${SHIPDIR}" ; \
$(mkinstalldirs) $$createdir
$(patsubst %, ${INSTDATABASE}/${SHIPDIR}/%, $(SHIP)) : ${INSTDATABASE}/${SHIPDIR}/% : %
$(INSTALL_DATA) $< $@
installshipmkdir:
@for D in $(SHIPCREATEDIRS) ; \
do echo " Creating ${INSTVARBASE}/$$D Directory" ; \
$(mkinstalldirs) ${INSTVARBASE}/$$D ; \
done
instshipdirs:
@RecurseDirs="${SHIPSUBDIRS}" ; \
RecurseFlags="install" ; \
${recursedirs}
installshipdirs:
@if [ -n "${SHIPSUBDIRS}" ] ; \
then R=`for I in ${SHIPSUBDIRS} ; \
do echo $$I ;\
done | sort -u` ; \
RecurseDirs="$$R" ; \
RecurseFlags="shipinstall" ; \
${recursedirs} ; \
fi