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

prefix=$(DESTDIR)/usr

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

all: $(EXTERNALS:.c=.pd_linux)

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

.SUFFIXES: .pd_linux

# Pentium III or better
#CPU_FLAGS = -march=pentium3
# PowerPC G3
#CPU_FLAGS = -mpowerpc-gpopt
# PowerPC G4
#CPU_FLAGS = -mpowerpc-gpopt -mcpu=7450 -maltivec
# PowerPC G5
#CPU_FLAGS = -mpowerpc64 -maltivec -falign-functions=32 -falign-labels=32 -falign-loops=32 -falign-jumps=32

OPTIM_FLAGS = -O3 -funroll-loops -fomit-frame-pointer $(CPU_FLAGS)

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

INCLUDES = -I. -I.. -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`
	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