makefile.in 9.59 KB
Newer Older
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
1
2
3
4
5
6
7
# On Mac OS X, this needs to be defined to enable dlopen and weak linking
# support.  Its safe on other platforms since gcc only checks this env var on
# Apple's gcc.  <hans@at.or.at>
ifeq ($(shell uname -s),Darwin)
export MACOSX_DEPLOYMENT_TARGET = 10.3
endif

Miller Puckette's avatar
Miller Puckette committed
8
9
10
VPATH = ../obj:./
OBJ_DIR = ../obj
BIN_DIR = ../bin
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
11
PDEXEC = $(BIN_DIR)/@PDEXEC@
Miller Puckette's avatar
Miller Puckette committed
12
13
14
15
16
17
18
19
EXT= @EXT@

prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
includedir = @includedir@
libdir = @libdir@
mandir = @mandir@
20
datarootdir = @datarootdir@
Miller Puckette's avatar
Miller Puckette committed
21
22
23
24
25

GFLAGS = -DINSTALL_PREFIX=\"$(prefix)\"

# varibles to match packages/Makefile.buildlayout so that they can be easily
# overridden when building Pd-extended builds. <hans@at.or.at>
26
libpddir = $(libdir)/pd-l2ork
Miller Puckette's avatar
Miller Puckette committed
27
28
29
30
31
pddocdir = $(libpddir)/doc
libpdbindir = $(libpddir)/bin

CPPFLAGS = @CPPFLAGS@
MORECFLAGS = @MORECFLAGS@
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
32
33
# if on 10.6/Intel, then build GUI as 32-bit
ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 10)
34
  GINCLUDE = -arch i386 $(CPPFLAGS)
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
35
else
36
  GINCLUDE = $(CPPFLAGS)
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
37
endif
Miller Puckette's avatar
Miller Puckette committed
38
39
40
41
42
43
GLIB = @LIBS@

LDFLAGS = @LDFLAGS@
LIB =  @PDLIB@

WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
44
    -Wno-unused-parameter -Wno-parentheses -Wno-switch
45
46
#WARN_CFLAGS += -Werror=implicit-function-declaration

Miller Puckette's avatar
Miller Puckette committed
47
48
49
50
51
52
53
54
55
56
57
58
ARCH_CFLAGS = -DPD 

CFLAGS = @CFLAGS@ $(ARCH_CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(MORECFLAGS)

# the sources

SYSSRC += @SYSSRC@

ASIOSRC = @ASIOSRC@

ASIOOBJ = $(ASIOSRC:.cpp=.o)

Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
59
60
61
62
63
64
# these files cause a warning when using auto-vectorization:
# "warning: dereferencing type-punned pointer will break strict-aliasing rules"
TYPE_PUNNING_SRC = d_ctl.c d_array.c d_delay.c d_filter.c d_math.c d_osc.c d_soundfile.c

# these are safe for full gcc 4.x optimization
OPT_SAFE_SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
65
    g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c g_clone.c \
66
67
    g_undo.c g_all_guis.c g_bang.c g_mycanvas.c g_numbox.c \
    g_toggle.c g_vumeter.c g_magicglass.c g_radio.c g_slider.c \
Miller Puckette's avatar
Miller Puckette committed
68
69
70
    m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
    m_conf.c m_glob.c m_sched.c \
    s_main.c s_inter.c s_file.c s_print.c \
71
72
    s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
	s_utf8.c \
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
73
74
75
    d_ugen.c d_arithmetic.c d_dac.c d_misc.c \
    d_fft.c d_global.c \
    d_resample.c \
Miller Puckette's avatar
Miller Puckette committed
76
    x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
77
    x_time.c x_acoustics.c x_net.c x_text.c x_gui.c x_list.c x_array.c x_preset.c\
78
	x_scalar.c x_vexp.c x_vexp_if.c x_vexp_fun.c import.c \
Miller Puckette's avatar
Miller Puckette committed
79
80
    $(SYSSRC)

Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
81
82
83
84
SRC = $(TYPE_PUNNING_SRC) $(OPT_SAFE_SRC)

TYPE_PUNNING_OBJ = $(TYPE_PUNNING_SRC:.c=.o) 
OPT_SAFE_OBJ = $(OPT_SAFE_SRC:.c=.o) 
Miller Puckette's avatar
Miller Puckette committed
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
OBJ = $(SRC:.c=.o) 

# get version from m_pd.h to use in doc/1.manual/1.introduction.txt
PD_MAJOR_VERSION := $(shell grep PD_MAJOR_VERSION m_pd.h | \
	sed 's|^.define *PD_MAJOR_VERSION *\([0-9]*\).*|\1|' )
PD_MINOR_VERSION := $(shell grep PD_MINOR_VERSION m_pd.h | \
	sed 's|^.define *PD_MINOR_VERSION *\([0-9]*\).*|\1|' )
PD_BUGFIX_VERSION := $(shell grep PD_BUGFIX_VERSION m_pd.h | \
	sed 's|^.define *PD_BUGFIX_VERSION *\([0-9]*\).*|\1|' )
PD_TEST_VERSION := $(shell grep PD_TEST_VERSION m_pd.h | \
	sed 's|^.define *PD_TEST_VERSION *"\(.*\)".*|\1|' )
PD_VERSION := $(PD_MAJOR_VERSION).$(PD_MINOR_VERSION).$(PD_BUGFIX_VERSION)
ifneq ($(PD_TEST_VERSION),)
	PD_VERSION := $(PD_VERSION)-$(PD_TEST_VERSION)
endif
100
101
102
# AG: Pd-l2ork version number
PD_L2ORK_VERSION := $(shell grep PD_L2ORK_VERSION m_pd.h.in | \
	sed 's|^.define *PD_L2ORK_VERSION *"\(.*\)".*|\1|' )
Miller Puckette's avatar
Miller Puckette committed
103
104
105
106
107

#
#  ------------------ targets ------------------------------------
#

108
.PHONY: pd externs all bin pd install \
109
        TAGS etags etags_Darwin etags_Linux etags_MINGW
Miller Puckette's avatar
Miller Puckette committed
110

111
all: pd $(BIN_DIR)/pd-watchdog $(BIN_DIR)/pdsend \
112
    $(BIN_DIR)/pdreceive externs
Miller Puckette's avatar
Miller Puckette committed
113

114
bin: pd $(BIN_DIR)/pd-watchdog $(BIN_DIR)/pdsend \
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
115
116
117
118
    $(BIN_DIR)/pdreceive

$(OPT_SAFE_OBJ) : %.o : %.c
	$(CC) $(CFLAGS) $(OPT_CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c 
Miller Puckette's avatar
Miller Puckette committed
119

Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
120
$(TYPE_PUNNING_OBJ) : %.o : %.c
Miller Puckette's avatar
Miller Puckette committed
121
122
123
124
125
126
127
128
129
	$(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c 

$(ASIOOBJ): %.o : %.cpp
	$(CXX) $(CFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.cpp

pd: $(PDEXEC)

pd-watchdog: $(BIN_DIR)/pd-watchdog

130
131
132
133
# just make sure ../bin exists without making it a target, because if you
# make it a target, "make" looks at the folder's changing timestamp and
# rebuilds for no reason. — Mathieu
NOTHING = $(shell mkdir -p $(BIN_DIR))
Miller Puckette's avatar
Miller Puckette committed
134

135
$(BIN_DIR)/pd-watchdog: s_watchdog.c
Miller Puckette's avatar
Miller Puckette committed
136
137
	$(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c

138
$(BIN_DIR)/pdsend: u_pdsend.c
Miller Puckette's avatar
Miller Puckette committed
139
140
141
142
143
	$(CC) $(CFLAGS)  $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c

$(BIN_DIR)/pdreceive: u_pdreceive.c $(BIN_DIR)
	$(CC) $(CFLAGS)  $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c

144
$(PDEXEC): $(OBJ)
Miller Puckette's avatar
Miller Puckette committed
145
	cd ../obj;  $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) $(LIB)
Miller Puckette's avatar
Miller Puckette committed
146

Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
147
148
149
150
151
152
# if on 10.6/Intel, then force build GUI as 32-bit
ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 10)
  ARCH_FLAG = -arch i386
else
  ARCH_FLAG = 
endif
153

Miller Puckette's avatar
Miller Puckette committed
154
externs: 
155
	make -C ../extra/bob~     @EXTERNTARGET@
Miller Puckette's avatar
Miller Puckette committed
156
157
158
159
160
161
162
	make -C ../extra/bonk~    @EXTERNTARGET@
	make -C ../extra/choice   @EXTERNTARGET@
	make -C ../extra/fiddle~  @EXTERNTARGET@
	make -C ../extra/loop~    @EXTERNTARGET@
	make -C ../extra/lrshift~ @EXTERNTARGET@
	make -C ../extra/pique    @EXTERNTARGET@
	make -C ../extra/sigmund~ @EXTERNTARGET@
Miller Puckette's avatar
Miller Puckette committed
163
164
	make -C ../extra/pd~      @EXTERNTARGET@
	make -C ../extra/stdout   @EXTERNTARGET@
Miller Puckette's avatar
Miller Puckette committed
165
166
167

BINARYMODE=@binarymode@

Miller Puckette's avatar
Miller Puckette committed
168
ABOUT_FILE=$(DESTDIR)$(pddocdir)/1.manual/1.introduction.txt
Jonathan Wilkes's avatar
Jonathan Wilkes committed
169
install: all
Miller Puckette's avatar
Miller Puckette committed
170
171
	install -d $(DESTDIR)$(libpdbindir)
	install $(BIN_DIR)/pd-watchdog $(DESTDIR)$(libpdbindir)/pd-watchdog
172
173
174
175
	install -d $(DESTDIR)$(libpdbindir)/nw
	install -d $(DESTDIR)$(libpdbindir)/css
	install -d $(DESTDIR)$(libpdbindir)/locales
	install -m644 ../nw/*.* $(DESTDIR)$(libpdbindir)/
176
	rsync -ax --exclude=.git --exclude=.svn ../nw/nw $(DESTDIR)$(libpdbindir)
177
178
179
180
181
182
	install -m644 ../nw/css/*.* $(DESTDIR)$(libpdbindir)/css/
	for dir in $(shell ls -1 ../nw/locales); do \
		echo "installing locale $$dir"; \
		install -d $(DESTDIR)$(libpdbindir)/locales/$$dir ; \
		install -m644 -p ../nw/locales/$$dir/*.* $(DESTDIR)$(libpdbindir)/locales/$$dir ; \
	done
Miller Puckette's avatar
Miller Puckette committed
183
	install -d $(DESTDIR)$(bindir)
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
184
	install $(BINARYMODE) $(PDEXEC) $(DESTDIR)$(bindir)/@PDEXEC@
185
186
# kludge to allow pd~ to work by default in pd-l2ork
	rm -f $(DESTDIR)$(libpddir)/pd
Ivica Bukvic's avatar
Ivica Bukvic committed
187
	ln -sf $(bindir)/pd-l2ork $(DESTDIR)$(libpddir)/pd-l2ork
188
	ln -sf $(bindir)/pd-l2ork $(DESTDIR)$(libpdbindir)/pd-l2ork
Miller Puckette's avatar
Miller Puckette committed
189
190
191
192
	install -m755 $(BIN_DIR)/pdsend $(DESTDIR)$(bindir)/pdsend
	install -m755 $(BIN_DIR)/pdreceive $(DESTDIR)$(bindir)/pdreceive 
	for dir in $(shell ls -1 ../doc | grep -v CVS); do \
		echo "installing $$dir"; \
Miller Puckette's avatar
Miller Puckette committed
193
194
		install -d $(DESTDIR)$(pddocdir)/$$dir ; \
		install -m644 -p ../doc/$$dir/*.* $(DESTDIR)$(pddocdir)/$$dir ; \
Miller Puckette's avatar
Miller Puckette committed
195
	done
196
197
198
# kludge install of additional pd-l2ork data structures docs
	cp -rf ../doc/4.data.structures/pd-l2ork $(DESTDIR)$(pddocdir)/4.data.structures/	
# and now the rest
Miller Puckette's avatar
Miller Puckette committed
199
200
	for dir in $(shell ls -1 ../doc/7.stuff | grep -v CVS); do \
		echo "installing 7.stuff/$$dir"; \
Miller Puckette's avatar
Miller Puckette committed
201
202
203
		install -d $(DESTDIR)$(pddocdir)/7.stuff/$$dir ; \
		install -m644 -p ../doc/7.stuff/$$dir/*.* \
                    $(DESTDIR)$(pddocdir)/7.stuff/$$dir ; \
Miller Puckette's avatar
Miller Puckette committed
204
205
	done
	mv $(ABOUT_FILE) $(ABOUT_FILE).tmp
206
	cat $(ABOUT_FILE).tmp | sed 's|PD_VERSION|Pd-l2ork version $(PD_L2ORK_VERSION) ($(PD_TEST_VERSION))|' \
Miller Puckette's avatar
Miller Puckette committed
207
208
		> $(ABOUT_FILE)
	rm $(ABOUT_FILE).tmp
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
209
	rsync -ax --exclude=.git --exclude=.svn ../extra $(DESTDIR)$(libpddir)/
210
211
212
213
214
215
	install -d $(DESTDIR)$(includedir)/pd-l2ork
	install -m644 m_pd.h $(DESTDIR)$(includedir)/pd-l2ork/m_pd.h
	install -m644 m_imp.h $(DESTDIR)$(includedir)/pd-l2ork/m_imp.h
	install -m644 g_canvas.h $(DESTDIR)$(includedir)/pd-l2ork/g_canvas.h
	install -m644 s_stuff.h $(DESTDIR)$(includedir)/pd-l2ork/s_stuff.h
	install -m644 g_all_guis.h $(DESTDIR)$(includedir)/pd-l2ork/g_all_guis.h
Miller Puckette's avatar
Miller Puckette committed
216
	install -d $(DESTDIR)$(mandir)/man1
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
217
218
	gzip < ../man/pd.1 >  $(DESTDIR)$(mandir)/man1/@PDEXEC@.1.gz
	chmod 644 $(DESTDIR)$(mandir)/man1/@PDEXEC@.1.gz
Miller Puckette's avatar
Miller Puckette committed
219
220
221
222
223
224
	gzip < ../man/pdsend.1 >  $(DESTDIR)$(mandir)/man1/pdsend.1.gz
	chmod 644 $(DESTDIR)$(mandir)/man1/pdsend.1.gz
	gzip < ../man/pdreceive.1 >  $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
	chmod 644 $(DESTDIR)$(mandir)/man1/pdreceive.1.gz
	@echo "Pd install succeeded."

Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
225
226
local-clean:	
	-rm -f -- $(OBJ)
227
	-rm -f ../obj/* $(PDEXEC) $(BIN_DIR)/pdsend \
Miller Puckette's avatar
Miller Puckette committed
228
	    $(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
229
	-rm -f -- *~
Miller Puckette's avatar
Miller Puckette committed
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
	-(cd ../doc/6.externs; rm -f *.pd_linux)
	-rm -f makefile.dependencies
	touch makefile.dependencies
	chmod 666 makefile.dependencies

extra-clean:
	-rm -f `find ../extra/ -name "*.pd_*"`
	-rm -f tags

clean: extra-clean local-clean

distclean: clean
	-rm -f config.cache config.log config.status makefile tags \
		autom4te.cache/output.* autom4te.cache/traces.* autom4te.cache/requests
	-rmdir autom4te.cache
	-rm -rf autom4te-*.cache

247
tags: $(SRC); ctags *.[ch]
Miller Puckette's avatar
Miller Puckette committed
248
249
250
251
252
253
254

depend: makefile.dependencies

makefile.dependencies: makefile
	$(CC) $(CPPFLAGS) -M $(SRC) > makefile.dependencies

uninstall:
Miller Puckette's avatar
Miller Puckette committed
255
	rm -f -r $(DESTDIR)$(libpddir)
Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
256
	rm -f $(DESTDIR)$(bindir)/@PDEXEC@
Miller Puckette's avatar
Miller Puckette committed
257
258
	rm -f $(DESTDIR)$(bindir)/pdsend
	rm -f $(DESTDIR)$(bindir)/pdreceive
259
	rm -f -r $(DESTDIR)$(includedir)/pd-l2ork/
Miller Puckette's avatar
Miller Puckette committed
260
261
262
263
264
265
266
	rm -f $(DESTDIR)$(mandir)/man1/pd.1.gz
	rm -f $(DESTDIR)$(mandir)/man1/pdsend.1.gz
	rm -f $(DESTDIR)$(mandir)/man1/pdreceive.1.gz

include makefile.dependencies


Hans-Christoph Steiner's avatar
Hans-Christoph Steiner committed
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
TAGS: etags

etags:
	etags *.h $(SRC) $(SYSSRC)
	find /usr/include -type f -name \*.h -exec etags -a '{}' \;
	make etags_`uname -s`

etags_Darwin:
	find /System/Library/Frameworks  -type f -name \*.h -exec etags -a '{}' \;
	find /Library/Frameworks  -type f -name \*.h -exec etags -a '{}' \;
	find /sw/include -type f -name \*.h -exec etags -a '{}' \;

etags_Linux:

etags_MINGW:
	find /usr/local/include/ -type f -name \*.h -exec etags -a '{}' \;