1
2CC = gcc
3
4c_sources = \
5	common.c \
6	decode.c \
7	decode_mc.c \
8	decode_ml.c \
9	decode_aug.c \
10	musicout.c \
11	audio_write.c \
12	subband.c \
13	alloc_tables.c \
14	crc.c
15
16OBJ = $(c_sources:.c=.o)
17
18#Uncomment this if you want to do some profiling
19#PG = -g
20
21# Optimize flag. 3 is about as high as you can sanely go with GCC3.2.
22OPTIM = -O3
23
24# These flags are pretty much mandatory
25REQUIRED = -DNDEBUG -DINLINE=inline
26
27#pick your architecture
28ARCH = -march=pentium
29#ARCH = -march=athlon-tbird
30#Possible x86 architectures
31#gcc3.2 => i386, i486, i586, i686, pentium, pentium-mmx
32#          pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3,
33#          athlon, athlon-tbird, athlon-4, athlon-xp and athlon-mp.
34
35#TWEAK the hell out of the compile. Some of these are real dodgy
36#TWEAKS = -finline-functions -fexpensive-optimizations -ffast-math -malign-double \
37#	-mfancy-math-387 -funroll-loops -funroll-all-loops -pipe \
38#	-fschedule-insns2 -fno-strength-reduce
39
40#Set a stack of warnings to overcome my atrocious coding style . MFC.
41WARNINGS = -Wall
42WARNINGS2 = -Wstrict-prototypes -Wmissing-prototypes -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wredundant-decls
43
44CC_SWITCHES = $(OPTIM) $(REQUIRED)  $(PG) $(TWEAKS) $(WARNINGS)
45
46PGM = mctoolamed
47
48LIBS =  -lm
49
50#nick burch's OS/2 fix  gagravarr@SoftHome.net
51UNAME = $(shell uname)
52ifeq ($(UNAME),OS/2)
53   SHELL=sh
54   PGM = toolame.exe
55   PG = -Zcrtdll -Zexe
56   LIBS =
57endif
58
59%.o: %.c Makefile
60	$(CC) $(CC_SWITCHES) -c $< -o $@
61
62$(PGM):	$(OBJ) Makefile
63	$(CC) $(PG) -o $(PGM) $(OBJ) $(LIBS)
64
65clean:
66	-rm $(OBJ) $(DEP)
67
68megaclean:
69	-rm $(OBJ) $(DEP) $(PGM) \#*\# *~
70
71distclean:
72	-rm $(OBJ) $(DEP) $(PGM) \#* *~ gmon.out gprof* core *shit* *.wav *.mp2 *.c.* *.mp2.* *.da *.h.* *.d *.mp3 *.pcm *.wav logfile
73
74tags: TAGS
75
76TAGS: ${c_sources}
77	etags -T ${c_sources}
78
79