Mercurial > remote-gamepad-server
comparison configure @ 0:e70ea46d6073
Initial import from http://wouhanegaine.free.fr/dev/DSPad02b_neo07.zip
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 22 Feb 2015 01:38:06 +0100 |
parents | |
children | 05c8e0aef77d |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e70ea46d6073 |
---|---|
1 #!/bin/sh | |
2 | |
3 #----------------- Fichiers et librairies ----------- | |
4 | |
5 TARGET='dspad_server' | |
6 | |
7 #FILESdspad='dspad.c ds.c uinput.c service.c' | |
8 FILESdspad_server=`ls *.c` | |
9 LDFLAGSdspad_server='' | |
10 | |
11 #----------------- Options de compilation ----------- | |
12 | |
13 INCDIR='.' | |
14 CCFLAGS='-I$(INCDIR) -D_REENTRANT -g' | |
15 | |
16 #------- Options de compilation propres au systeme ----------- | |
17 | |
18 systeme=`uname` | |
19 | |
20 if test $systeme = "IRIX" | |
21 then | |
22 | |
23 #---- SGI - IRIX ---- | |
24 | |
25 CCFLAGS='-fullwarn '$CCFLAGS | |
26 | |
27 LDFLAGS='-Wl,-woff,15,-woff,84,-woff,85' | |
28 | |
29 DEPOPT='-M' | |
30 | |
31 CCC='cc' | |
32 | |
33 elif test $systeme = "Linux" | |
34 then | |
35 | |
36 #---- Linux ---- | |
37 | |
38 CCFLAGS='-W -Wall -Werror '$CCFLAGS | |
39 #CCFLAGS=$CCFLAGS' -pedantic' | |
40 | |
41 LDFLAGS='' | |
42 | |
43 DEPOPT='-MM' | |
44 | |
45 CCC='cc' | |
46 | |
47 else echo "System $systeme inconnu" | |
48 exit 1 | |
49 fi | |
50 | |
51 #----------------- L'option -e de echo existe ? ---------------- | |
52 | |
53 recho=`echo -e` | |
54 | |
55 if test "$recho" = "-e" | |
56 then echoOptionForTab='' # echo "\t" permet d'afficher tab | |
57 else echoOptionForTab='-e' # echo -e "\t" permet d'afficher tab | |
58 fi | |
59 | |
60 #----------------- Nom du fichier genere ------------------------ | |
61 | |
62 makefile=makefile | |
63 | |
64 #----------------- Extension des fichiers ----------------------- | |
65 | |
66 extension=".c" | |
67 | |
68 #----------------- Au moins une cible existe ? ------------------ | |
69 | |
70 if test -z "$TARGET" | |
71 then echo | |
72 echo "Attention, aucune cible (TARGET) n'est indiquee !" | |
73 exit 1; | |
74 fi | |
75 | |
76 #----------------- INCDIR (ou trouver les .h) ? ----------------- | |
77 if test -z "$INCDIR" | |
78 then echo | |
79 echo "Attention, INCDIR non indique, par defaut : INCDIR='.'" | |
80 INCDIR='.' | |
81 fi | |
82 | |
83 #-------- Il ne faut pas de cible avec extension .c ----------- | |
84 | |
85 error=0 | |
86 for i in $TARGET | |
87 do | |
88 if test $i != `basename $i $extension` | |
89 then echo "Attention, la cible $i est un fichier source !!" | |
90 error=1 | |
91 fi | |
92 done | |
93 if test $error -ne 0 | |
94 then exit 1 | |
95 fi | |
96 | |
97 #--- Pour chaque cible, | |
98 #--- il faut verifier si la variable FILEScible est vide --- | |
99 #--- ET | |
100 #--- il faut verifier la variable FILEScible n'est composee que de .c --- | |
101 printFilesList() | |
102 { | |
103 #nbEspaces=`expr index $1 =` | |
104 strLocal=`expr $1 : '\(.*\)='` | |
105 nbEspaces=`expr length $strLocal` | |
106 nbEspaces=`expr $nbEspaces + 1` | |
107 | |
108 strLocalEspaces=" " | |
109 iLocal=0 | |
110 | |
111 while test $iLocal -ne $nbEspaces | |
112 do | |
113 strLocalEspaces=$strLocalEspaces" " | |
114 iLocal=`expr $iLocal + 1` | |
115 done | |
116 | |
117 echo $1 | |
118 shift | |
119 while test $# -ne 0 | |
120 do | |
121 echo "$strLocalEspaces"$1 # Il faut mettre les "" !! | |
122 shift | |
123 done | |
124 } # Fin de printFilesList() | |
125 | |
126 for i in $TARGET | |
127 do | |
128 echo "--------------- FILES$i ---------------" | |
129 | |
130 findFileList="echo \$`echo FILES$i`" | |
131 fileList=`eval $findFileList` | |
132 | |
133 if test -z "$fileList" | |
134 then echo "Attention, FILES$i est vide => FILES$i=$i$extension" | |
135 com="FILES$i=$i$extension" | |
136 eval $com | |
137 fi | |
138 | |
139 findFileList="echo \$`echo FILES$i`" | |
140 fileList=`eval $findFileList` | |
141 | |
142 realFileList="" | |
143 for j in $fileList | |
144 do | |
145 if test $j = `basename $j $extension` | |
146 then echo "Attention, dans FILES$i, $j est ignore (!= $extension)... " | |
147 else | |
148 if test -z "$realFileList" | |
149 then realFileList=$j | |
150 else realFileList=$realFileList" "$j | |
151 fi | |
152 fi | |
153 done | |
154 if test -z "$realFileList" | |
155 then | |
156 echo "... Donc , FILES$i est vide => FILES$i=$i$extension" | |
157 realFileList="$i$extension" | |
158 fi | |
159 | |
160 echo | |
161 com="FILES$i=\"$realFileList\"" | |
162 printFilesList $com # Avant : echo $com | |
163 echo | |
164 echo "---------------------------------------" | |
165 eval $com | |
166 done | |
167 | |
168 #-------- Pour generer les dependances, il faut des fichiers ! -------------- | |
169 | |
170 sourceList=`ls *$extension` | |
171 | |
172 if test -z "$sourceList" | |
173 then echo "Il n'y a aucun source ($extension) dans le repertoire courant" | |
174 exit 1 | |
175 fi | |
176 | |
177 #----------------- generation automatique ------------------- | |
178 putFilesListInMakefile() | |
179 { | |
180 strLocal="" | |
181 for iLocal in $1 | |
182 do | |
183 strLocal=$strLocal" "$iLocal | |
184 done | |
185 set $strLocal | |
186 echo -n $1 >> $makefile | |
187 shift | |
188 while test $# -ne 0 | |
189 do | |
190 echo " \\" >> $makefile | |
191 echo $echoOptionForTab -n "\t$1" >> $makefile | |
192 shift | |
193 done | |
194 echo >> $makefile | |
195 } # Fin de printFilesList() | |
196 | |
197 if test -f $makefile | |
198 then make -f $makefile clear | |
199 fi | |
200 rm -f $makefile | |
201 | |
202 echo | |
203 echo "============= GENERATION D'UN FICHIER $makefile ============" | |
204 echo | |
205 echo Generation pour $systeme | |
206 echo | |
207 | |
208 | |
209 echo "#----- Fichier genere automatiquement sous `uname` ------" >> $makefile | |
210 echo "#----- `date`" >> $makefile | |
211 echo >> $makefile | |
212 | |
213 echo "#-----" >> $makefile | |
214 echo "INCDIR=$INCDIR" >> $makefile | |
215 echo "CCFLAGS=$CCFLAGS" >> $makefile | |
216 echo "LDFLAGS=$LDFLAGS" >> $makefile | |
217 echo "DEPOPT=$DEPOPT" >> $makefile | |
218 echo "CCC=$CCC" >> $makefile | |
219 echo "#-----" >> $makefile | |
220 echo >> $makefile | |
221 | |
222 echo "#------------- Appli --------------" >> $makefile | |
223 echo >> $makefile | |
224 | |
225 | |
226 putFilesListInMakefile "TARGET=$TARGET" | |
227 echo >> $makefile | |
228 | |
229 for i in $TARGET | |
230 do | |
231 findFileList="echo \$`echo FILES$i`" | |
232 fileList=`eval $findFileList` | |
233 | |
234 putFilesListInMakefile "FILES$i=$fileList" >> $makefile | |
235 echo >> $makefile | |
236 findFalgList="echo \$`echo LDFLAGS$i`" | |
237 falgList=`eval $findFalgList` | |
238 echo "LDFLAGS$i=\$(LDFLAGS) $falgList" >> $makefile | |
239 echo >> $makefile | |
240 done | |
241 | |
242 for i in $TARGET | |
243 do | |
244 echo "OBJECTS$i=\$(FILES$i:$extension=.o)" >> $makefile | |
245 echo >> $makefile | |
246 done | |
247 | |
248 echo "#------------- Appli --------------" >> $makefile | |
249 echo >> $makefile | |
250 | |
251 echo "all: \$(TARGET)" >> $makefile | |
252 echo >> $makefile | |
253 | |
254 echo "#------------- Appli --------------" >> $makefile | |
255 echo >> $makefile | |
256 | |
257 for i in $TARGET | |
258 do | |
259 | |
260 cat << ! >> $makefile | |
261 $i : \$(OBJECTS$i) | |
262 \$(CCC) \$(OBJECTS$i) \\ | |
263 -o $i \$(LDFLAGS$i) | |
264 ! | |
265 | |
266 done | |
267 | |
268 echo "#------------------------------------" >> $makefile | |
269 echo >> $makefile | |
270 | |
271 cat << ! >> $makefile | |
272 .c.o : | |
273 \$(CCC) \$(CCFLAGS) -c \$< \\ | |
274 -o \$*.o | |
275 | |
276 dep : | |
277 @echo "======== Mise a jour des dependances : .depend ========" | |
278 @rm -f .depend | |
279 @for i in *$extension ; do \\ | |
280 echo \$\$i ; \\ | |
281 \$(CCC) \$(DEPOPT) \$(CCFLAGS) \$\$i > .tmpdepend ; \\ | |
282 OBJNAME=\`echo \$\$i | sed -e s%\\\\\\$extension%.o% \` ; \\ | |
283 cat .tmpdepend | \\ | |
284 sed -e s%\`basename \$\$i $extension\`\\\\\.o%\$\$OBJNAME% \ | |
285 >> .depend ; \\ | |
286 echo >> .depend ; \\ | |
287 done | |
288 @rm -f .tmpdepend | |
289 | |
290 CLEANING=rm -f *.o core a.out \$(TARGET) .depend | |
291 CONSEIL=echo Penser a faire : make -f $makefile dep | |
292 | |
293 clear : | |
294 @\$(CLEANING) | |
295 @echo | |
296 @\$(CONSEIL) | |
297 @echo | |
298 clean : | |
299 \$(CLEANING) | |
300 @echo | |
301 @\$(CONSEIL) | |
302 @echo | |
303 | |
304 sinclude .depend | |
305 | |
306 ! | |
307 | |
308 echo | |
309 echo "Et execution de : make -f $makefile dep" | |
310 echo | |
311 make -f $makefile dep |