3 CFLAGS = -pipe -g -O2 -Wall
7 # Some "black" magic to determine optimal compiler flags for target
9 TARGET_ARCH:= $(shell if [ \! -r .compile-options ] ; then ( \
10 cpu=`grep cpu /proc/cpuinfo 2>&1 |head -1| \
11 cut -d : -f 2-| sed -e 's/ //g'`; \
12 if [ x"$$cpu" = x"" ] ; then \
13 echo -fno-strength-reduce; \
14 else if [ "$$cpu" = "386" ] ; then \
15 echo -m386 -fno-strength-reduce; \
16 else if [ "$$cpu" = "486" ] ; then \
17 echo -m486 -fno-strength-reduce; \
18 else if [ "$$cpu" = "Alpha" ] ; then \
19 echo -fno-strength-reduce; \
20 else echo main\(\)\{\} >.compile-options.c; \
21 if gcc -mpentium -o .compile-options.o -c \
22 .compile-options.c &>/dev/null; then \
23 echo -mpentium -fstrength-reduce; \
24 else if gcc -m486 -malign-functions=2 -malign-jumps=2 \
25 -malign-loops=2 -o .compile-options.o -c \
26 .compile-options.c &>/dev/null; then \
27 echo -n -m486 -malign-functions=2 -malign-jumps=2; \
28 echo ' '-malign-loops=2 -fno-strength-reduce; \
30 fi;fi;fi;fi;fi;fi) > .compile-options; \
31 rm -f .compile-options.c .compile-options.o; \
32 fi; cat .compile-options)
33 ASFLAGS = $(TARGET_ARCH)
37 ##############################################################################
39 ifeq (.depend,$(wildcard .depend))
47 ##############################################################################
51 ##############################################################################
54 $(RM) *~ *.o *.dvi *.log *.aux *yacc.tab.[ch] *yacc.output *lex.[co] \
55 *.dat .depend .tmp_depend .compile-options*
56 strip rom-scan >&/dev/null || true
58 ##############################################################################
61 for i in *.c;do $(CPP) $(CPPFLAGS) -MM $$i;done >.tmp_depend
62 mv .tmp_depend .depend