blob: 4c0c51a65bf5c87753b4068886b5537ad102ac93 (
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
|
EXTERNALS = $(shell ls *.c)
CPPEXTERNALS = $(shell ls *.cpp)
STRIP = strip --strip-unneeded -R .note -R .comment
all: $(EXTERNALS:.c=.pd_linux) $(CPPEXTERNALS:.cpp=.pd_linux)
# this might be a better way to do this:
# EXTERNALS := ${patsubst %.c, %.o, ${wildcard *.c}}
# all: ${EXTERNALS}
.SUFFIXES: .pd_linux
STK = $(shell ls -d stk*/)
CFLAGS = -I$(STK)include
# cross-platform default
CPU_FLAGS = -O2
OPTIM_FLAGS = -funroll-loops -fomit-frame-pointer $(CPU_FLAGS)
FLAGS = -fPIC -DPD -DUNIX $(OPTIM_FLAGS) \
-Wall -W -Wshadow -Wstrict-prototypes \
-Wno-unused -Wno-parentheses -Wno-switch $(CFLAGS)
INCLUDES = -I. -I.. -I../../build/include
%.pd_linux: %.c
$(CC) $(FLAGS) $(INCLUDES) -o "$*.o" -c "$+"
gcc -Wl,-export_dynamic -shared -o "$@" "$*.o" -lc -lm
chmod a-x "$@"
$(STRIP) $@
rm -f "$*.o"
%.pd_linux: %.cpp
$(CXX) $(FLAGS) $(INCLUDES) -o "$*.o" -c "$+"
$(CXX) -Wl,-export_dynamic -shared -o "$@" "$*.o" -lc -lm $(STK)src/libstk.a
chmod a-x "$@"
$(STRIP) $@
rm -f "$*.o"
clean:
-rm *.pd_linux *~ *.o
-rm link.stamp
|