aboutsummaryrefslogtreecommitdiff
path: root/packages/Makefile.buildlayout
blob: fe338da53579f527adee3c680037dcea6adbd8c6 (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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#==============================================================================#
#
# Centralized cross-platform build system Makefile.buildsystem
#
# this file contains all the common locations and targets
#  <hans@at.or.at>
#
#==============================================================================#
# This file should be exactly the same in each section of the CVS.  A copy is
# kept in each section of the CVS so that each section will be self-contained.
# To use it, you need to include it in your Makefile (i.e. "include
# Makefile.buildlayout") and then define $(prefix) and $(cvs_root_dir).
#
# $(cvs_root_dir) is the base directory of src tree, equivalent to the root
# level of the pure-data CVS.
#
# $(prefix) is the base directory to where all of the resulting files
# will be copied.
#
# This file is currently located in these places: 
#	  abstractions
#    extensions
#	  externals
# 	  packages
#    doc
#
# it will be going here too:
#    gem
#    pd
#
# <hans@at.or.at>

#==============================================================================#
#
## PLATFORM-SPECIFIC SETTINGS
#
#==============================================================================#
# which OS to compile for
UNAME := $(shell uname -s)
ifeq ($(UNAME),Linux)
  OS_NAME = linux
  EXTENSION = pd_linux
  DYLIB_EXTENSION = so
  LN_S = ln -s
endif
ifeq ($(UNAME),Darwin)
  OS_NAME = darwin
  EXTENSION = pd_darwin
  DYLIB_EXTENSION = dylib
  LN_S = ln -s
endif
ifeq (MINGW,$(findstring MINGW,$(UNAME)))
  OS_NAME = windows
  EXTENSION = dll
  DYLIB_EXTENSION = dll
  LN_S = cp -a
endif
ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
  OS_NAME = windows
  EXTENSION = dll
  DYLIB_EXTENSION = dll
  LN_S = ln -s
endif
# which CPU to compile for
UNAME_MACHINE := $(shell uname -m)
ifeq ($(UNAME_MACHINE),i386)
  ARCH = i386
endif
ifeq ($(UNAME_MACHINE),i686)
  ARCH = i386
endif
ifeq ($(UNAME_MACHINE),ppc)
  ARCH = powerpc
endif

#==============================================================================#
#
## CFLAGS
#
#==============================================================================#

# base level optimizations
OPT_CFLAGS = -O2

DEBUG_CFLAGS = -ggdb

#==============================================================================#
#
# DIRECTORY STRUCTURE
#
#==============================================================================#

# sources
abstractions_src = $(cvs_root_dir)/abstractions
doc_src = $(cvs_root_dir)/doc
extensions_src = $(cvs_root_dir)/extensions
externals_src = $(cvs_root_dir)/externals
flext_src = $(cvs_root_dir)/externals/grill/flext
gem_src = $(cvs_root_dir)/externals/Gem
packages_src = $(cvs_root_dir)/packages
pd_src = $(cvs_root_dir)/pd
scripts_src = $(cvs_root_dir)/scripts


# destinations
bindir = $(prefix)/bin
includedir = $(prefix)/include
mandir = $(prefix)/man

libdir = $(prefix)/lib
ifeq ($(OS_NAME),darwin)
  libpddir = $(prefix)
  libpdbindir = $(bindir)
  else
    ifeq ($(OS_NAME),windows)
      libpddir = $(prefix)/.
      libpdbindir = $(bindir)
    else
      libpddir = $(libdir)/pd-extended
      libpdbindir = $(libpddir)/bin
    endif
endif

objectsdir = $(libpddir)/extra
pddocdir = $(libpddir)/doc
helpdir = $(pddocdir)/5.reference
manualsdir = $(pddocdir)/manuals


#==============================================================================#
#
# DIRECTORY STRUCTURE TARGETS
#
#==============================================================================#

# first make sure that the directory structure is setup
$(DESTDIR):
	install -d $(DESTDIR)

$(bindir): $(DESTDIR)
	install -d $(DESTDIR)$(bindir)

$(includedir): $(DESTDIR)
	install -d $(DESTDIR)$(includedir)

$(pddocdir): $(DESTDIR)
	install -d $(DESTDIR)$(pddocdir)

$(helpdir): $(DESTDIR)
	install -d $(DESTDIR)$(helpdir)

$(manualsdir): $(DESTDIR)
	install -d $(DESTDIR)$(manualsdir)

$(objectsdir): $(DESTDIR)
	install -d $(DESTDIR)$(objectsdir)

installdirs: $(DESTDIR) $(bindir) $(pddocdir) $(includedir) $(helpdir) $(manualsdir) $(objectsdir)

#==============================================================================#
#
# PD VERSION AND PACKAGE NAMING
#
#==============================================================================#


PD_MAJOR_VERSION := $(shell grep PD_MAJOR_VERSION $(pd_src)/src/m_pd.h | \
	sed 's|^.define *PD_MAJOR_VERSION *\([0-9]*\).*|\1|' )
PD_MINOR_VERSION := $(shell grep PD_MINOR_VERSION $(pd_src)/src/m_pd.h | \
	sed 's|^.define *PD_MINOR_VERSION *\([0-9]*\).*|\1|' )
PD_BUGFIX_VERSION := $(shell grep PD_BUGFIX_VERSION $(pd_src)/src/m_pd.h | \
	sed 's|^.define *PD_BUGFIX_VERSION *\([0-9]*\).*|\1|' )
PD_TEST_VERSION := $(shell grep PD_TEST_VERSION $(pd_src)/src/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

VERSION_DATE := $(shell date +%Y%m%d)

# release version for this distro
PD-EXTENDED_VERSION_PREFIX = extended
PD-EXTENDED_VERSION = $(PD-EXTENDED_VERSION_PREFIX)-$(VERSION_DATE)

PACKAGE_NAME = Pd-$(PD_VERSION)


#==============================================================================#
#
# CLEAN TARGETS
#
#==============================================================================#

applications_clean:
	-rm -f -- $(DESTDIR)$(examplesdir)/*/*/*/*/*.*
	-rm -f -- $(DESTDIR)$(examplesdir)/*/*/*/*.*
	-rm -f -- $(DESTDIR)$(examplesdir)/*/*/*.*
	-rm -f -- $(DESTDIR)$(examplesdir)/*/*.*
	-rmdir $(DESTDIR)$(examplesdir)/*/*/*/*
	-rmdir $(DESTDIR)$(examplesdir)/*/*/*
	-rmdir $(DESTDIR)$(examplesdir)/*/*
	-rmdir $(DESTDIR)$(examplesdir)/*
	-rmdir $(DESTDIR)$(examplesdir)


help_clean:
	-rm -f -- $(DESTDIR)$(helpdir)/*/*/*.*
	-rm -f -- $(DESTDIR)$(helpdir)/*/*.*
	-rm -f -- $(DESTDIR)$(helpdir)/*.*
	-rmdir $(DESTDIR)$(helpdir)/*/*
	-rmdir $(DESTDIR)$(helpdir)/*
	-rmdir $(DESTDIR)$(helpdir)


manuals_clean:
	-rm -f -- $(DESTDIR)$(manualsdir)/*/*/*.*
	-rm -f -- $(DESTDIR)$(manualsdir)/*/*.*
	-rmdir $(DESTDIR)$(manualsdir)/*/*
	-rmdir $(DESTDIR)$(manualsdir)/*
	-rmdir $(DESTDIR)$(manualsdir)


objects_clean:
	-rm $(DESTDIR)$(objectsdir)/*/*/*.pd
	-rm $(DESTDIR)$(objectsdir)/*/*.pd
	-rm $(DESTDIR)$(objectsdir)/*.pd
	-rm $(DESTDIR)$(objectsdir)/*/*/*.$(EXTENSION)
	-rm $(DESTDIR)$(objectsdir)/*/*.$(EXTENSION)
	-rm $(DESTDIR)$(objectsdir)/*.$(EXTENSION)
	-rmdir $(DESTDIR)$(objectsdir)/*/*
	-rmdir $(DESTDIR)$(objectsdir)/*
	-rmdir $(DESTDIR)$(objectsdir)


install_clean: applications_clean help_clean manuals_clean objects_clean
	-rmdir $(DESTDIR)$(pddocdir)
	-rmdir $(DESTDIR)$(prefix)
	-rmdir $(DESTDIR)
	@echo " "
	@echo "Build destination cleaned: $(DESTDIR)"


cruft_clean:
# emacs litter
	-rm -f -- */*/*/*/*.*~
	-rm -f -- */*/*/*.*~
	-rm -f -- */*/*.*~
	-rm -f -- */*.*~
	-rm -f -- *.*~
	-rm -f -- Makefile~ Makefile.buildlayout~
# sed replace litter
	-rm -f -- */*/*/*/*.bak
	-rm -f -- */*/*/*.bak
	-rm -f -- */*/*.bak
	-rm -f -- */*.bak
	-rm -f -- *.bak
# patching replace litter
	-rm -f -- */*/*/*/*.rej
	-rm -f -- */*/*/*.rej
	-rm -f -- */*/*.rej
	-rm -f -- */*.rej
	-rm -f -- *.rej
# autoconf cache
	-rm -rf -- */*/*/*/autom4te.cache
	-rm -rf -- */*/*/autom4te.cache
	-rm -rf -- */*/autom4te.cache
	-rm -rf -- */autom4te.cache
	-rm -rf -- autom4te.cache