-
Notifications
You must be signed in to change notification settings - Fork 0
/
.RUNME
executable file
·715 lines (630 loc) · 18.5 KB
/
.RUNME
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
#!/bin/bash
#
# Copyright (C) 2014 Neil McGill
#
# This game is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This game is distributed in the hope that it will be fun,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Library General Public License for more details.
#
# You should have received a copy of the GNU Library General Public
# License along with this game; if not, write to the Free
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
. ./scripts/common.sh
case `uname` in
*MING*|*MSYS*)
# Goog link for mingw install hints
# log_info "Installing python dependancies:"
log_info "Installing python dependancies:"
pacman --force --noconfirm -S mingw-w64-x86_64-python3
pacman --force --noconfirm -S mingw-w64-x86_64-python3-pip
pacman --force --noconfirm -S mingw-w64-x86_64-python3-cx_Freeze
/mingw64/bin/pip3 install colored
/mingw64/bin/pip3 install hexdump
;;
*Darwin*)
# sudo python3 -m pip install --upgrade pip
port install python3-pip
python3 -m pip install colored
python3 -m pip install hexdump
;;
*)
apt-get install python3-pip3
pip3 install colored
pip3 install hexdump
;;
esac
case `uname` in
*MING*|*MSYS*)
for i in \
/mingw/bin/sdl2-config \
/mingw64/bin/sdl2-config
do
if [ -x $i ]
then
SDL2_CONFIG=$i
break
fi
done
;;
*)
for i in \
/opt/local/bin/sdl2-config \
/usr/local/bin/sdl2-config \
/usr/bin/sdl2-config
do
if [ -x $i ]
then
SDL2_CONFIG=$i
break
fi
done
;;
esac
#
# Prefer SDL over SDL2 as it seems more common
#
case `uname` in
*MING*|*MSYS*)
for i in \
/mingw/bin/sdl-config \
/mingw64/bin/sdl-config
do
if [ -x $i ]
then
SDL1_CONFIG=$i
break
fi
done
;;
*)
for i in \
/opt/local/bin/sdl-config \
/usr/local/bin/sdl-config \
/usr/bin/sdl-config
do
if [ -x $i ]
then
SDL1_CONFIG=$i
break
fi
done
;;
esac
sdl_help()
{
log_warn "Is SDL 1.2 or 1.3 installed? If not:"
case `uname` in
*MING*|*MSYS*)
log_warn " Installed already:"
pacman -Ss | grep '^mingw64/' | grep SDL | sed 's/^mingw64.//g' | grep installed
log_warn " Will try to install needed packages:"
pacman -S \
mingw-w64-x86_64-SDL \
mingw-w64-x86_64-SDL2 \
mingw-w64-x86_64-SDL2_gfx \
mingw-w64-x86_64-SDL2_image \
mingw-w64-x86_64-SDL2_mixer \
mingw-w64-x86_64-SDL2_net \
mingw-w64-x86_64-SDL2_ttf \
mingw-w64-x86_64-SDL_gfx \
mingw-w64-x86_64-SDL_image \
mingw-w64-x86_64-SDL_mixer \
mingw-w64-x86_64-SDL_net \
mingw-w64-x86_64-SDL_ttf
log_warn "Ok, try RUNME again"
exit 1
;;
*Darwin*)
log_warn "Install MAC ports then install:"
log_warn " sudo port install libsdl2"
log_warn " sudo port install libsdl2_mixer"
log_warn " sudo port install libsdl2_ttf"
;;
*)
log_warn " For ubuntu SDL2 do: "
log_warn " sudo apt-get install libsdl2.0-dev"
log_warn " sudo apt-get install libsdl-mixer2.0-dev"
log_warn ""
log_warn " For ubuntu SDL1.2 do: "
log_warn " sudo apt-get install libsdl1.2-dev"
log_warn " sudo apt-get install libsdl-mixer1.2-dev"
;;
esac
}
SDL1_SCORE=0
SDL2_SCORE=0
if [ "$SDL1_CONFIG" != "" ]; then
SDL1_INC_PATH=`$SDL1_CONFIG --cflags | sed 's/.*-I\([a-zA-Z\/_0-9:\.]*\) .*/\1/g'`
find $SDL1_INC_PATH | grep -q SDL_mixer.h
if [ $? -eq 0 ]; then
SDL1_SCORE=`expr $SDL1_SCORE + 1`
SDL1_MIXER=`find $SDL1_INC_PATH -name SDL_mixer.h`
fi
fi
if [ "$SDL2_CONFIG" != "" ]; then
SDL2_INC_PATH=`$SDL2_CONFIG --cflags | sed 's/.*-I\([a-zA-Z\/_0-9:\.]*\) .*/\1/g'`
find $SDL2_INC_PATH | grep -q SDL_mixer.h
if [ $? -eq 0 ]; then
SDL2_SCORE=`expr $SDL2_SCORE + 1`
SDL2_MIXER=`find $SDL2_INC_PATH -name SDL_mixer.h`
fi
fi
if [[ "$SDL1_CONFIG" != "" ]]; then
log_info "SDL1 config : $SDL1_CONFIG"
log_info "SDL1 version : "`$SDL1_CONFIG --version`
log_info "SDL1 include path: $SDL1_INC_PATH"
log_info "SDL1 mixer.h : $SDL1_MIXER"
log_info "SDL1 score : $SDL1_SCORE"
fi
if [[ "$SDL2_CONFIG" != "" ]]; then
log_info "SDL2 config : $SDL2_CONFIG"
log_info "SDL2 version : "`$SDL2_CONFIG --version`
log_info "SDL2 include path: $SDL2_INC_PATH"
log_info "SDL2 mixer.h : $SDL2_MIXER"
log_info "SDL2 score : $SDL2_SCORE"
fi
USE_SDL1=0
USE_SDL2=0
if [[ $SDL1_SCORE = "0" ]]; then
if [[ $SDL2_SCORE = "0" ]]; then
log_err "I need SDL1 or SDL2 and SDL mixer"
sdl_help
exit 1
else
SDL_CONFIG=$SDL2_CONFIG
USE_SDL2=1
fi
elif [[ $SDL2_SCORE = "0" ]]; then
if [[ $SDL1_SCORE = "0" ]]; then
log_err "I need SDL1 or SDL2 and SDL mixer"
sdl_help
exit 1
else
SDL_CONFIG=$SDL1_CONFIG
USE_SDL1=1
fi
else
if [[ $SDL2_SCORE -ge $SDL1_SCORE ]]; then
log_info "Prefer SDL2 as it has more headers"
SDL_CONFIG=$SDL2_CONFIG
USE_SDL2=1
else
log_info "Prefer SDL1 as it has more headers"
SDL_CONFIG=$SDL1_CONFIG
USE_SDL1=1
fi
fi
#
# Gives warings at runtime on MACOS
#
SDL_LIBS=`$SDL_CONFIG --libs`
if [ $? -ne 0 ]
then
log_err "Please install SDL 1.2 or 1.3. $SDL_CONFIG failed."
log_err "SDL-1.2.14.tar.gz is in support/"
exit 1
fi
C_FLAGS=`$SDL_CONFIG --cflags`
if [ $? -ne 0 ]
then
log_err "Please install SDL 1.2 or 1.3. $SDL_CONFIG failed."
log_err "SDL-1.2.14.tar.gz is in support/"
exit 1
fi
log_info "SDL version:" `$SDL_CONFIG --version`
log_info " ($SDL_CONFIG)"
#
# -funwind-tables and -rdynamic for backtrace info on linux.
# But it seemed to help little.
#
LDLIBS="$SDL_LIBS"
if [ "$USE_SDL2" = "1" ]
then
# LDLIBS="$LDLIBS -lSDL2_ttf"
LDLIBS="$LDLIBS -lSDL2_mixer"
else
# LDLIBS="$LDLIBS -lSDL_ttf"
LDLIBS="$LDLIBS -lSDL_mixer"
fi
case `uname` in
*MING*|*MSYS*)
for i in \
/mingw/bin/python3-config \
/mingw64/bin/python3-config
do
if [ -x $i ]
then
Python3_CONFIG=$i
break
fi
done
;;
*)
for i in \
/opt/local/bin/python3-config \
/usr/local/bin/python3-config \
/usr/bin/python3-config
do
if [ -x $i ]
then
Python3_CONFIG=$i
break
fi
done
;;
esac
#
# Prefer Python over Python3 as it seems more common
#
case `uname` in
*MING*|*MSYS*)
for i in \
/mingw/bin/python-config \
/mingw64/bin/python-config
do
if [ -x $i ]
then
Python2_CONFIG=$i
break
fi
done
;;
*)
for i in \
/opt/local/bin/python-config \
/usr/local/bin/python-config \
/usr/bin/python-config
do
if [ -x $i ]
then
Python2_CONFIG=$i
break
fi
done
;;
esac
python_help()
{
log_warn "Is python3 installed ?"
case `uname` in
*MING*|*MSYS*)
log_warn " Installed already:"
pacman -Ss | grep '^mingw64/' | grep python3 | sed 's/^mingw64.//g' | grep installed
log_warn " Will try to install needed packages:"
pacman -S \
mingw-w64-x86_64-python3 \
mingw-w64-x86_64-python3-pip \
mingw-w64-x86_64-python3-py
log_warn "Ok, try RUNME again"
exit 1
;;
*Darwin*)
log_warn "Install MAC ports then install:"
log_warn " sudo port install python3*"
;;
*)
log_warn " For ubuntu Python3 do: "
log_warn " sudo apt-get install python3-dev"
log_warn " sudo apt-get install python3-pip"
;;
esac
}
Python2_SCORE=0
Python3_SCORE=0
if [ "$Python2_CONFIG" != "" ]; then
Python2_INC_PATH=`$Python2_CONFIG --cflags | sed 's/.*-I\([a-zA-Z\/_0-9:\.]*\) .*/\1/g'`
find $Python2_INC_PATH | grep -q Python.h
if [ $? -eq 0 ]; then
Python2_SCORE=`expr $Python2_SCORE + 1`
fi
fi
if [ "$Python3_CONFIG" != "" ]; then
Python3_INC_PATH=`$Python3_CONFIG --cflags | sed 's/.*-I\([a-zA-Z\/_0-9:\.]*\) .*/\1/g'`
find $Python3_INC_PATH | grep -q Python.h
if [ $? -eq 0 ]; then
Python3_SCORE=`expr $Python3_SCORE + 1`
fi
fi
log_info "Python2 config : $Python2_CONFIG"
log_info "Python2 : "`$Python2_CONFIG --exec-prefix`
log_info "Python2 include path: $Python2_INC_PATH"
log_info "Python2 score : $Python2_SCORE"
if [[ "$Python3_CONFIG" != "" ]]; then
log_info "Python3 config : $Python3_CONFIG"
log_info "Python3 : "`$Python3_CONFIG --exec-prefix`
log_info "Python3 include path: $Python3_INC_PATH"
log_info "Python3 score : $Python3_SCORE"
fi
USE_Python2=0
USE_Python3=0
if [[ $Python2_SCORE = "0" ]]; then
if [[ $Python3_SCORE = "0" ]]; then
log_err "I need Python3"
python_help
exit 1
else
Python_CONFIG=$Python3_CONFIG
USE_Python3=1
fi
elif [[ $Python3_SCORE = "0" ]]; then
if [[ $Python2_SCORE = "0" ]]; then
log_err "I need Python3"
python_help
exit 1
else
# Python_CONFIG=$Python2_CONFIG
# USE_Python2=1
log_err "I need Python3"
python_help
exit 1
fi
else
if [[ $Python3_SCORE -ge $Python2_SCORE ]]; then
log_info "Prefer Python3"
Python_CONFIG=$Python3_CONFIG
USE_Python3=1
else
log_err "I need Python3"
python_help
exit 1
# log_info "Prefer Python2"
# Python_CONFIG=$Python2_CONFIG
# USE_Python2=1
fi
fi
/bin/rm -f data/mundusmeus-hiscore.txt data/mundusmeus-config.txt
### #
### # Make the ramdisk
### #
### RAMDISK_FILES=.ramdisk_files
###
### log_info "Creating ramdisk filelist"
###
### find data -type f | grep -v Resources | grep -v DS_Store | grep -v "\.ttf$" | grep -v "xcf" | grep -v "mp3" | grep -v "\.session" | grep -v "^\." > $RAMDISK_FILES
### if [ ! -s $ramdisk_files ]
### then
### cd src
### log_die "Failed to build list of ramdisk files"
### fi
###
### mkdir -p src/asm
### scripts/RUNME.ramdisk.pl $RAMDISK_FILES
### if [ $? -ne 0 ]
### then
### log_die "Failed to make ramdisk files"
### fi
###
### /bin/rm -f $RAMDISK_FILES
#
# Make the makefile
#
cd src
rm -f Makefile
cat Makefile.base | sed '/DO NOT DELETE/,$d' > Makefile.tmp
mv Makefile.tmp Makefile
case `uname` in
*MING*|*MSYS*)
makedepend *.c -p .o/ 2>/dev/null
if [ $? -ne 0 ]; then
../third-party/makedepend *.c -p .o/ 2>/dev/null
fi
;;
*)
makedepend *.c -p .o/ 2>/dev/null
;;
esac
if [ $? -ne 0 ]; then
log_warn "Is makedepend installed? If not:"
log_warn " For ubuntu do: sudo apt-get install xutils-dev"
log_warn " For MAC do: sudo port install makedepend"
log_warn " For MingW do: look in third-party for Win32 binary"
case `uname` in
*MING*|*MSYS*)
echo
log_warn "If you still can't find it, I have the source in third-party"
log_warn " cd third-party"
log_warn " tar xvf makedepend-1.0.5.tar.gz"
log_warn " cd makedepend-1.0.5"
log_warn " ./configure"
;;
esac
log_warn "Hit enter to continue; I'll ignore this error."
log_warn "It's not essential. Rebuilds will be slower is all."
read dummy
makedepend *.c -p .o/ 2>/dev/null
fi
cd ..
#
# Gives warings at runtime on MACOS
#
Python_LIBS=`$Python_CONFIG --ldflags`
if [ $? -ne 0 ]
then
log_err "Please install Python 3. $Python_CONFIG failed."
exit 1
fi
C_FLAGS="$C_FLAGS `$Python_CONFIG --cflags | \
tr ' ' '\n' | \
grep -v specs | \
grep -v debug-prefix | \
grep -v O3 | \
grep -v O2 | \
grep -v Os | \
grep -v wrapv | \
grep -v strict-proto | \
tr '\n' ' ' \
`"
#
# -funwind-tables and -rdynamic for backtrace info on linux.
# But it seemed to help little.
#
LDLIBS="$LDLIBS $Python_LIBS"
#
# for backtraces, but it doesn't help much
#
case `uname` in
*MSYS*)
PATH=/mingw64/bin:$PATH
export PATH
EXE=".exe"
C_FLAGS="$C_FLAGS -mwin32"
C_FLAGS="$C_FLAGS -I/mingw64/x86_64-w64-mingw32/include"
LDLIBS="$LDLIBS -L/mingw64/x86_64-w64-mingw32/lib/"
LDLIBS=`echo $LDLIBS | sed -e 's/-lmingw32 //g'`
LDLIBS="$LDLIBS -lopengl32"
LDLIBS="$LDLIBS -funwind-tables"
;;
*Darwin*)
EXE=""
LDLIBS="$LDLIBS -funwind-tables"
LDLIBS="$LDLIBS -rdynamic"
LDLIBS="$LDLIBS -Wl,-framework,Opengl"
DSYM="dsymutil ../mundusmeus"
WERROR="-Werror"
COMPILER_WARN="-Wmissing-prototypes"
;;
*MING*)
EXE=""
LDLIBS="$LDLIBS -funwind-tables"
LDLIBS="$LDLIBS -lopengl32"
LDLIBS="$LDLIBS -Wl,-framework,Opengl"
DSYM="dsymutil ../mundusmeus"
WERROR="-Werror"
COMPILER_WARN="-Wmissing-prototypes"
;;
*)
EXE=""
LDLIBS="$LDLIBS -funwind-tables"
LDLIBS="$LDLIBS -lGL"
#
# Better to leave off for production
#
WERROR="-Werror"
COMPILER_WARN="-Wmissing-prototypes"
;;
esac
C_FLAGS="$C_FLAGS -DVERSION=\\\"$VERSION\\\""
#
# Better to leave off for production
#
#WERROR=""
#LDLIBS="$LDLIBS -lpthread"
cd src
echo "COMPILER_FLAGS=$WERROR $C_FLAGS -g -ggdb3 -O2 # AUTOGEN" > .Makefile
echo " " >> .Makefile
echo "CLANG_COMPILER_WARNINGS=-Wall -fmessage-length=0 -fdiagnostics-print-source-range-info -fdiagnostics-show-category=id -fdiagnostics-parseable-fixits -Wno-trigraphs $COMPILER_WARN -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-sign-conversion # AUTOGEN" >> .Makefile
echo "GCC_COMPILER_WARNINGS=-Wall -fmessage-length=0 -Wno-trigraphs $COMPILER_WARN -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value # AUTOGEN" >> .Makefile
echo "GXX_COMPILER_WARNINGS=-x c++ -Wall -fmessage-length=0 -Wno-trigraphs -Wreturn-type -Wparentheses -Wswitch -Wno-unused-parameter -Wunused-variable -Wunused-value # AUTOGEN" >> .Makefile
`clang --version >/dev/null 2>/dev/null`
if [ $? -eq 0 ]
then
echo "COMPILER_WARNINGS=\$(GCC_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GXX_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(CLANG_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "CC=clang # AUTOGEN" >> .Makefile
echo "# CC=gcc # AUTOGEN" >> .Makefile
echo "# CC=cc # AUTOGEN" >> .Makefile
echo "# CC=g++ # AUTOGEN" >> .Makefile
else
`gcc --version >/dev/null 2>/dev/null`
if [ $? -eq 0 ]
then
echo "COMPILER_WARNINGS=\$(CLANG_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GXX_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GCC_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "# CC=clang # AUTOGEN" >> .Makefile
echo "CC=gcc # AUTOGEN" >> .Makefile
echo "# CC=cc # AUTOGEN" >> .Makefile
echo "# CC=g++ # AUTOGEN" >> .Makefile
else
`g++ --version >/dev/null 2>/dev/null`
if [ $? -eq 0 ]
then
echo "COMPILER_WARNINGS=\$(CLANG_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GCC_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GXX_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "# CC=clang # AUTOGEN" >> .Makefile
echo "# CC=gcc # AUTOGEN" >> .Makefile
echo "# CC=cc # AUTOGEN" >> .Makefile
echo "CC=g++ # AUTOGEN" >> .Makefile
else
echo "COMPILER_WARNINGS=\$(CLANG_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GXX_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "COMPILER_WARNINGS=\$(GCC_COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
echo "# CC=clang # AUTOGEN" >> .Makefile
echo "# CC=gcc # AUTOGEN" >> .Makefile
echo "# CC=cc # AUTOGEN" >> .Makefile
echo "CC=g++ # AUTOGEN" >> .Makefile
fi
fi
fi
case `uname` in
*MSYS*)
echo "CC=/mingw64/bin/x86_64-w64-mingw32-gcc.exe # AUTOGEN" >> .Makefile
LDLIBS="$LDLIBS -lmingw32 -lSDL2main -lSDL2 -mwindows /mingw64/lib/libSDL2main.a -L/mingw64/lib -lSDL2main -lSDL2"
;;
esac
echo " " >> .Makefile
echo "EXE=$EXE # AUTOGEN" >> .Makefile
echo "DSYM=$DSYM # AUTOGEN" >> .Makefile
echo "LDLIBS=$LDLIBS # AUTOGEN" >> .Makefile
echo "CFLAGS=\$(COMPILER_FLAGS) \$(COMPILER_WARNINGS) # AUTOGEN" >> .Makefile
cat Makefile | grep -v AUTOGEN | grep -v "^ $" >> .Makefile
if [ -s .Makefile ]
then
mv .Makefile Makefile
if [ ! -f Makefile ]
then
log_err "No makefile?!"
exit 1
fi
else
log_err "Makefile create fail?!"
exit 1
fi
log_info "Cleaning"
make clobber | sed 's/^/ /g'
CORES=""
case `uname` in
*Darwin*)
CORES=`/usr/sbin/system_profiler -detailLevel full SPHardwareDataType | grep Cores | sed 's/.*: //g'`
;;
*inux*)
CORES=`cat /proc/cpuinfo | grep "cpu cores" | head -1 | awk '{print $4}'`
;;
esac
if [ "$CORES" != "" ]
then
CORES="-j $CORES"
fi
log_info "Compiling"
make $CORES $* all
if [ $? -eq 0 ]
then
echo
case `uname` in
*MING*|*MSYS*)
log_info "You likely will need the following to run:"
log_info "export PYTHONPATH=/mingw64/lib/python3.5/:/mingw64/lib/python3.5/lib-dynload:/mingw64/lib/python3.5/site-packages/"
log_info "Run ./mundusmeus.exe to start"
;;
*)
log_info "Run ./mundusmeus to start"
;;
esac
rm -f Makefile.bak
else
cd ..
log_die "Build failed"
sdl_help
exit 1
fi
cd ..
exit 0