aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 665387f206737525d02de87e0b0ea9ebc79233b6 (plain)
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
CC = gcc

c_sources = \
	common.c \
	encode.c \
	ieeefloat.c \
	toolame.c \
	portableio.c \
	psycho_n1.c \
	psycho_0.c \
	psycho_1.c \
	psycho_2.c \
	psycho_3.c \
	psycho_4.c \
	fft.c \
	subband.c \
	audio_read.c \
	bitstream.c \
	mem.c \
	crc.c \
	tables.c \
	availbits.c \
	ath.c \
	encode_new.c \
	zmqoutput.c

OBJ = $(c_sources:.c=.o)

#Uncomment this if you want to do some profiling/debugging
#PG = -g -pg
PG = -g -fomit-frame-pointer

# Optimize flag.
OPTIM = -O2

# These flags are pretty much mandatory
REQUIRED = -DNDEBUG -DINLINE=inline

#pick your architecture
ARCH = -march=native
#Possible x86 architectures
#gcc3.2 => i386, i486, i586, i686, pentium, pentium-mmx
#          pentiumpro, pentium2, pentium3, pentium4, k6, k6-2, k6-3,
#          athlon, athlon-tbird, athlon-4, athlon-xp and athlon-mp.

#TWEAK the hell out of the compile. Some of these are real dodgy
# and will cause program instability
#TWEAKS = -finline-functions -fexpensive-optimizations -ffast-math \
#	-malign-double \
#	-mfancy-math-387 -funroll-loops -funroll-all-loops -pipe \
#	-fschedule-insns2 -fno-strength-reduce

#Set a stack of warnings to overcome my atrocious coding style . MFC.
WARNINGS = -Wall
WARNINGS2 = -Wstrict-prototypes -Wmissing-prototypes -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-variable -Wunused-value -Wredundant-decls

NEW_02L_FIXES = -DNEWENCODE -DNEWATAN

CC_SWITCHES = $(OPTIM) $(REQUIRED) $(ARCH) $(PG) $(TWEAKS) $(WARNINGS) $(NEW_02L_FIXES)

PGM = toolame

LIBS =  -lm -lzmq

#nick burch's OS/2 fix  gagravarr@SoftHome.net
UNAME = $(shell uname)
ifeq ($(UNAME),OS/2)
   SHELL=sh     
   PGM = toolame.exe
   PG = -Zcrtdll -Zexe
   LIBS =
endif

%.o: %.c Makefile
	$(CC) $(CC_SWITCHES) -c $< -o $@

$(PGM):	$(OBJ) Makefile
	$(CC) $(PG) -o $(PGM) $(OBJ) $(LIBS)

clean:
	-rm $(OBJ) $(DEP)

megaclean:
	-rm $(OBJ) $(DEP) $(PGM) \#*\# *~

distclean:
	-rm $(OBJ) $(DEP) $(PGM) \#* *~ gmon.out gprof* core *shit* *.wav *.mp2 *.c.* *.mp2.* *.da *.h.* *.d *.mp3 *.pcm *.wav logfile

tags: TAGS

TAGS: ${c_sources}
	etags -T ${c_sources}