aboutsummaryrefslogtreecommitdiff
path: root/externals/build/linux/makefile
blob: 3e7782831cfd1c21921ad877ebe7c10bb39deb30 (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

prefix=$(DESTDIR)/usr

EXTERNALS = $(shell ls ../src)
STRIP = strip --strip-unneeded -R .note -R .comment

all: 
	make -k externals
	
externals: $(EXTERNALS:.c=.pd_linux)

# this might be a better way to do this:
# EXTERNALS    := ${patsubst %.c, %.o, ${wildcard *.c}} 
# all: ${EXTERNALS}

.SUFFIXES: .pd_linux

# cross-platform default
CPU_FLAGS = -O2

# AMD Athlon XP K7
#CPU_FLAGS = -O3 -march=athlon-xp -m3dnow -msse -mfpmath=sse

# Generic x86 (tune for 686, since that's most common these days)
# CPU_FLAGS = -O2 -mcpu=i686
# Pentium MMX
#CPU_FLAGS = -O3 -march=pentium-mmx -mmmx
# Pentium Pro
#CPU_FLAGS = -O3 -march=pentiumpro -mmmx
# Pentium II/Celeron
#CPU_FLAGS = -O3 -mfpmath=sse -mmmx -msse -march=pentium2
# Pentium III/Celeron2
#CPU_FLAGS = -O3 -mfpmath=sse -mmmx -msse -march=pentium3
# Pentium 4
#CPU_FLAGS = -O3 -mfpmath=sse -mmmx -msse -msse2 -march=pentium4

# PowerPC 750 (G3)
#CPU_FLAGS = -O3 -mpowerpc-gpopt -mcpu=750
# PowerPC 7400 (G4 <= 700MHz)
#CPU_FLAGS = -O3 -mpowerpc-gpopt -mcpu=7400 -maltivec
# PowerPC 7450 (G4 >= 533Mhz)
#CPU_FLAGS = -O3 -mpowerpc-gpopt -mcpu=7450 -maltivec
# PowerPC G5
#CPU_FLAGS = -O3 -mpowerpc64 -maltivec -falign-functions=32 -falign-labels=32 -falign-loops=32 -falign-jumps=32

OPTIM_FLAGS = -funroll-loops -fomit-frame-pointer -fno-strict-aliasing $(CPU_FLAGS)

CFLAGS = -fPIC -DPD -DUNIX $(OPTIM_FLAGS)  \
    -Wall -W -Wshadow -Wstrict-prototypes  \
    -Wno-unused -Wno-parentheses -Wno-switch

INCLUDES = -I. -I.. -I../../../pd/src -I../include

%.pd_linux: ../src/%.c
	$(CC) $(CFLAGS) $(INCLUDES) -o "$*.o" -c "../src/$*.c"
	gcc -Wl,-export_dynamic  -shared -o "$*.pd_linux" "$*.o" -lc -lm \
		`test -f $*.libs && cat $*.libs` \
		`test -f ../src/$*.libs && cat ../src/$*.libs`
	chmod a-x "$*.pd_linux"
	$(STRIP) $*.pd_linux
	rm -f "$*.o" 

clean:
	-rm *.pd_linux *~ *.c
	-rm link.stamp

install-doc:
	@test -d $(prefix)/lib/pd/doc/5.reference || mkdir -p $(prefix)/lib/pd/doc/5.reference
	cd ../doc && make all
	cp -r ../doc/* $(prefix)/lib/pd/doc/5.reference

install: install-doc
	@test -d $(prefix)/lib/pd/extra || mkdir -p $(prefix)/lib/pd/extra
	install -m644 *.pd_linux $(prefix)/lib/pd/extra


deb:
	cd ../.. && dpkg-buildpackage -b