aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/flext/makefile.pd-darwin
blob: c84c316314db47f859601dc171958bbdecd780b9 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# flext - C++ layer for Max/MSP and pd (pure data) externals
# Copyright (c) 2001-2003 Thomas Grill (xovo@gmx.net)
#
# Makefile for gcc @ darwin
# 
# usage:
# to build run "make -f makefile.pd-darwin"
# to install (as root), do "make -f makefile.pd-darwin install"
#

CONFIG=config-pd-darwin.txt

include ${CONFIG}

# compiler+linker stuff 
INCLUDES=${PDPATH}
FLAGS=-DFLEXT_SYS=2 -Wno-unused -Wno-parentheses -Wno-switch -Wstrict-prototypes
FLAGS+=${UFLAGS}
CFLAGS=-O6 
CFLAGS_D=-g
CFLAGS_T=-DFLEXT_THREADS
LIBS=gcc 


# ----------------------------------------------
# the rest can stay untouched
# ----------------------------------------------

NAME=flext

SRCDIR=source

# all the source files from the package
include make-files.txt

ifdef SNDOBJ
INCLUDES+=$(SNDOBJ)
SRCS+=$(SRCS_SNDOBJ)
HDRS+=$(HDRS_SNDOBJ)
endif

ifdef STK
INCLUDES+=$(STK)
SRCS+=$(SRCS_STK)
HDRS+=$(HDRS_STK)
endif

# for FLEXT_USE_SIMD
CFLAGS+=-framework Carbon -framework veclib -Fveclib -FCarbon

MAKEFILE=makefile.pd-darwin
ifdef V4_NAMING
TARGET=$(TARGDIR)/lib$(NAME).a
TARGET_D=$(TARGDIR)/lib$(NAME)_d.a
TARGET_T=$(TARGDIR)/lib$(NAME)_t.a
TARGET_TD=$(TARGDIR)/lib$(NAME)_td.a
else
TARGET=$(TARGDIR)/$(NAME).a
TARGET_D=$(TARGDIR)/$(NAME)_d.a
TARGET_T=$(TARGDIR)/$(NAME)_t.a
TARGET_TD=$(TARGDIR)/$(NAME)_td.a
endif
TARGET_S=$(TARGDIR)/lib$(NAME).dylib
TARGET_SD=$(TARGDIR)/lib$(NAME)_d.dylib

all: $(TARGDIR) $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD)   $(TARGET_S) $(TARGET_SD)

$(TARGDIR):
	mkdir $(TARGDIR)

$(patsubst %,$(SRCDIR)/%,$(SRCS)): $(patsubst %,$(SRCDIR)/%,$(HDRS)) $(patsubst %,$(SRCDIR)/%,$(IHDRS)) $(MAKEFILE) $(CONFIG)
	touch $@

$(TARGDIR)/%.o : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@

$(TARGDIR)/%.do : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS_D) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@

$(TARGDIR)/%.to : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@

$(TARGDIR)/%.tdo : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@

$(TARGDIR)/%.so : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS) $(CFLAGS_T) $(FLAGS) -DFLEXT_SHARED $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@

$(TARGDIR)/%.sdo : $(SRCDIR)/%.cpp
	$(CXX) -c -dynamic $(CFLAGS_D) $(CFLAGS_T) $(FLAGS) -DFLEXT_SHARED $(patsubst %,-I%,$(INCLUDES) $(SRCDIR)) $< -o $@

$(TARGET) : $(patsubst %.cpp,$(TARGDIR)/%.o,$(SRCS)) 
	libtool -static -o $@ $^

$(TARGET_D) : $(patsubst %.cpp,$(TARGDIR)/%.do,$(SRCS)) 
	libtool -static -o $@ $^

$(TARGET_T) : $(patsubst %.cpp,$(TARGDIR)/%.to,$(SRCS))
	libtool -static -o $@ $^

$(TARGET_TD) : $(patsubst %.cpp,$(TARGDIR)/%.tdo,$(SRCS))
	libtool -static -o $@ $^

$(TARGET_S) : $(patsubst %.cpp,$(TARGDIR)/%.so,$(SRCS))
	ld -dylib -dynamic -flat_namespace -undefined suppress -lgcc -lstdc++ -ldylib1.o -o $@ $^

$(TARGET_SD) : $(patsubst %.cpp,$(TARGDIR)/%.sdo,$(SRCS))
	ld -dylib -dynamic -flat_namespace -undefined suppress -lgcc -lstdc++ -ldylib1.o -o $@ $^

.PHONY: clean install

clean:
	rm -f $(TARGDIR)/*.{o,do,to,tdo,so,sdo} $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD)
	
ifdef INSTDIR
$(INSTDIR):
	-mkdir $(INSTDIR)

install:: $(INSTDIR)
endif

install:: $(TARGET) $(TARGET_D) $(TARGET_T) $(TARGET_TD) $(TARGET_S) $(TARGET_SD) $(patsubst %,$(SRCDIR)/%,$(HDRS)) 
	cp $^ $(INSTDIR)
	mv $(INSTDIR)/lib*.dylib /usr/local/lib
	ranlib $(INSTDIR)/*.a  # have to rerun ranlib at install dir ?!
#	chmod 755 $(patsubst %,$(INSTDIR)/%,$(notdir $^))
#	chgrp admin $(patsubst %,$(INSTDIR)/%,$(notdir $^))