File: Makefile.fpc

package info (click to toggle)
lazarus 1.2.4%2Bdfsg2-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 170,220 kB
  • ctags: 115,165
  • sloc: pascal: 1,386,898; xml: 257,878; sh: 2,935; java: 603; makefile: 549; perl: 297; sql: 174; ansic: 137
file content (404 lines) | stat: -rw-r--r-- 13,082 bytes parent folder | download | duplicates (2)
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
#
#   Makefile.fpc for Lazarus for Free Pascal
#

[package]
name=lazarus
version=$(IDEVERSION)

[require]
packages=regexpr

[target]
programs=lazarus startlazarus lazbuild
dirs=

[compiler]

[clean]
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT)) $(wildcard *.lfm)

[install]
fpcpackage=n
basedir=share/lazarus

[dist]
destdir=$(BASEDIR)/dist

[prerules]
RCPP?=$(strip $(firstword cpp$(SRCEXEEXT)))
#
LAZARUS_INSTALL_DIR=$(INSTALL_PREFIX)/share/lazarus
INSTALL_MAN_DIR=$(INSTALL_PREFIX)/share/man
ifneq ($(findstring $(OS_TARGET),win32 win64),)
LAZARUS_INSTALL_DIR=C:\lazarus
endif
ifneq ($(findstring $(OS_TARGET),freebsd),)
LAZARUS_INSTALL_DIR=/usr/local/lazarus
endif
ifneq ($(findstring $(OS_TARGET),win32 win64),)
IDEVERSION=$(shell .\tools\install\get_lazarus_version.bat)
else
IDEVERSION=$(shell ./tools/install/get_lazarus_version.sh)
endif

#-----------------------------------------------------------------------------
[rules]
.PHONY: help registration lazutils codetools tools lcl basecomponents bigidecomponents lazbuild ide idepkg idebig cleanide bigide useride starter lhelp all clean purge install

#-----------------------------------------------------------------------------
help:
	@$(ECHO)
	@$(ECHO) " Main targets"
	@$(ECHO) "                  Without any target, target 'all' will be invoked."
	@$(ECHO) "   all            build minimal IDE, lazbuild, startlazarus."
	@$(ECHO) "   clean          deletes files that 'all' creates"
	@$(ECHO) "   lazbuild       build lazbuild and lcl with nogui widgetset"
	@$(ECHO) "   bigide         as all, except that the IDE is built with a lot of extra packages"
	@$(ECHO) "   useride        calls lazbuild to build an IDE with your active profile, requires lazbuild"
	@$(ECHO) "   install        installs Lazarus under $(LAZARUS_INSTALL_DIR)"
	@$(ECHO) "                  You can change the directory by appending INSTALL_PREFIX=/some/path"
	@$(ECHO)
	@$(ECHO) " Sub targets"
	@$(ECHO) "   registration   build package FCL"
	@$(ECHO) "   lazutils       build package LazUtils, requires registration"
	@$(ECHO) "   codetools      build package CodeTools, requires lazutils"
	@$(ECHO) "   lcl            build package LCL, requires lazutils"
	@$(ECHO) "   tools          build lazres, svn2revisioninc, updatepofiles, lrstolfm, requires LCL with nogui widgetset"
	@$(ECHO) "   basecomponents build lazcontrols, synedit, ideintf for the LCL_PLATFORM, requires lcl"
	@$(ECHO) "   bigidecomponents build many extra packages for the LCL_PLATFORM, requires basecomponents"
	@$(ECHO) "   lhelp          build lhelp, requires bigidecomponents"
	@$(ECHO) "   starter        build startlazarus, requires basecomponents"
	@$(ECHO) "   examples       build basic examples, requires basecomponents"
	@$(ECHO) "                  Note: There are more examples having their own directory"
	@$(ECHO)
	@$(ECHO) " Usage examples:"
	@$(ECHO)
	@$(ECHO) " Updating svn and build a minimal IDE, startlazarus and lazbuild:"
	@$(ECHO) "   make clean"
	@$(ECHO) "   svn up"
	@$(ECHO) "   make clean all"
	@$(ECHO)
	@$(ECHO) " Note: You can start lazarus with 'startlazarus'"
	@$(ECHO) " Note: Use the IDE or lazbuild to compile your projects/packages."
	@$(ECHO)
	@$(ECHO) " Updating svn and build an IDE with your last set of packages:"
	@$(ECHO) "   make clean"
	@$(ECHO) "   svn up"
	@$(ECHO) "   make clean lazbuild useride"
	@$(ECHO)
	@$(ECHO) " Clean up:"
	@$(ECHO) "  There is no command to clean up a svn repository completely, but"
	@$(ECHO) "  you can use the following command under Linux/OS X:"
	@$(ECHO) "  svn status | grep '\?' | sed -e 's/\? *//' | xargs rm -r"
	@$(ECHO)
	@$(ECHO) "  Another possibility is to create a clean copy via the "svn export" command."
	@$(ECHO)
	@$(ECHO) " Install:"
	@$(ECHO) "   Note: You can use Lazarus without installing. Just start the lazarus executable."
	@$(ECHO) "   1. Build Lazarus as normal user with one of the above commands."
	@$(ECHO) "   2. Install as root into /usr"
	@$(ECHO) "          sudo make install"
	@$(ECHO) "      This installs startlazarus, lazarus-ide, lazbuild under /usr/bin"
	@$(ECHO) "      and copies the whole lazarus source directory to /usr/share/lazarus"
	@$(ECHO)
	@exit

#-----------------------------------------------------------------------------
# build package FCL (shared by all LCL_PLATFORMs)
registration:
	$(MAKE) -C packager/registration

#-----------------------------------------------------------------------------
# build package LazUtils, requires registration (shared by all LCL_PLATFORMs)
lazutils:
	$(MAKE) -C components/lazutils

#-----------------------------------------------------------------------------
# build package CodeTools, requires lazutils (shared by all LCL_PLATFORMs)
codetools:
	$(MAKE) -C components/codetools

#-----------------------------------------------------------------------------
# build package LCLBase and LCL for LCL_PLATFORM
# requires lazutils
lcl:
	$(MAKE) -C lcl

#-----------------------------------------------------------------------------
# build lazcontrols, synedit, ideintf for the LCL_PLATFORM
# (Note: lazutils and codetools are shared on all LCL platforms)
# requires lcl
basecomponents:
	$(MAKE) -C components/lazcontrols
	$(MAKE) -C components/synedit
	$(MAKE) -C components/ideintf

#-----------------------------------------------------------------------------
# build a lot of extra packages for the LCL_PLATFORM
# requires basecomponents
bigidecomponents:
	$(MAKE) -C components bigide

#-----------------------------------------------------------------------------
# build lazres, svn2revisioninc, updatepofiles, lrstolfm
# requires codetools and LCL with nogui widgetset
tools:
	$(MAKE) -C tools

#-----------------------------------------------------------------------------
# create/update ide/revision.inc
# requires tools
revisioninc:
	$(MAKE) -C ide revisioninc

#-----------------------------------------------------------------------------
# build lazarus exe with minimum of packages for the LCL_PLATFORM
# requires basecomponents and tools
ide:
	$(MAKE) -C ide ide

#-----------------------------------------------------------------------------
# build lazarus exe with bigide packages for the LCL_PLATFORM
# requires bigidecomponents and tools
idebig:
	$(MAKE) -C ide bigide

#-----------------------------------------------------------------------------
# build lazarus exe with user's packages for the LCL_PLATFORM
# requires user's packages, idemake.cfg and staticpackages.inc
# called by the IDE/lazbuild
# the idemake.cfg and staticpackages.inc are created by the IDE or by lazbuild
idepkg:
	$(MAKE) -C ide idepkg

#-----------------------------------------------------------------------------
# calls lazbuild to build lazarus and packages with user's settings
# requires lazbuild
# ignores LCL_PLATFORM and OPTS
useride: 
	./lazbuild$(SRCEXEEXT) --lazarusdir=. --build-ide=

#-----------------------------------------------------------------------------
starter:
	$(MAKE) -C ide starter

#-----------------------------------------------------------------------------
lazbuild: registration lazutils codetools
	$(MAKE) -C lcl LCL_PLATFORM=nogui
	$(MAKE) -C tools
	$(MAKE) -C components/lazcontrols LCL_PLATFORM=nogui
	$(MAKE) -C components/synedit LCL_PLATFORM=nogui
	$(MAKE) -C components/ideintf LCL_PLATFORM=nogui
	$(MAKE) -C ide lazbuilder LCL_PLATFORM=nogui

#-----------------------------------------------------------------------------
# build lhelp
# requires bigidecomponents
lhelp:
	$(MAKE) -C components/chmhelp/lhelp

#-----------------------------------------------------------------------------
# build examples for the LCL_PLATFORM
# requires basecomponents
examples:
	$(MAKE) -C examples

#-----------------------------------------------------------------------------
# build lazarus,lcl,lazbuild,startlazarus with base packages for the LCL_PLATFORM
all: lazbuild lcl basecomponents ide starter

#-----------------------------------------------------------------------------
# build lazarus,lcl,lazbuild,startlazarus,lhelp with bigide packages for the LCL_PLATFORM
bigide: lazbuild lcl basecomponents bigidecomponents idebig starter lhelp

#-----------------------------------------------------------------------------
cleanide:
	$(MAKE) -C ide cleanide

cleanlaz: cleanide
	$(MAKE) -C packager/registration clean
	$(MAKE) -C lcl cleanall
	$(MAKE) -C components clean

clean: cleanlaz
	$(MAKE) -C . cleanlaz LCL_PLATFORM=nogui
	$(MAKE) -C tools clean
	$(MAKE) -C components/chmhelp/lhelp clean

cleanbigide: clean

purge: clean
	$(MAKE) -C examples clean
#	$(MAKE) -C doceditor clean

cleanall: purge

# create dirs
installbase:
ifneq ($(findstring $(OS_TARGET),win32 win64),)

else
	$(MKDIR) $(INSTALL_PREFIX)/share
	$(MKDIR) $(INSTALL_PREFIX)/share/lazarus
	$(MKDIR) $(INSTALL_BINDIR)
	$(MKDIR) $(INSTALL_MAN_DIR)
	$(MKDIR) $(INSTALL_MAN_DIR)/man1
endif
#-----------------------------------------------------------------------------
# Many "make" users expect 'make install' to copy the binaries to somewhere
# Copy the lazarus tree to the install directory and set some links
# Copy everything except for 'debian' to avoid recursion and other platform files
install:
	$(MAKE) installbase
	$(COPYTREE) packager debugger designer converter ide images languages lazarus.app units $(LAZARUS_INSTALL_DIR)
	$(COPYTREE) components docs doceditor examples lcl test install tools $(LAZARUS_INSTALL_DIR)
	$(COPYTREE) Makefile* *.txt *.bat *.sh $(LAZARUS_INSTALL_DIR)
	$(COPYTREE) lazarus startlazarus lazbuild $(LAZARUS_INSTALL_DIR)
ifneq ($(findstring $(OS_TARGET),win32 win64),)

else
	ln -sf $(LAZARUS_INSTALL_DIR)/lazarus $(INSTALL_PREFIX)/bin/lazarus-ide
	ln -sf $(LAZARUS_INSTALL_DIR)/startlazarus $(INSTALL_PREFIX)/bin/startlazarus
	ln -sf $(LAZARUS_INSTALL_DIR)/lazbuild $(INSTALL_PREFIX)/bin/lazbuild
	cat install/man/man1/lazarus-ide.1 | gzip > $(INSTALL_MAN_DIR)/man1/lazarus-ide.1.gz
	cat install/man/man1/startlazarus.1 | gzip > $(INSTALL_MAN_DIR)/man1/startlazarus.1.gz
	cat install/man/man1/lazbuild.1 | gzip > $(INSTALL_MAN_DIR)/man1/lazbuild.1.gz
endif


##########################################################################
# Debian
##########################################################################

# Build dir
ifndef BUILDDIR
BUILDDIR=$(BASEDIR)/build
endif

ifeq ($(OS_TARGET),linux)

ifndef DEBDIR
DEBDIR=debian
endif

# Link Tree
ifdef LINKISCOPY
ifndef LINKTREE
LINKTREE:=$(CPPROG) -Rfpl
endif
else
ifndef LINKTREE
LINKTREE:=$(CPPROG) -Rfpl
endif
endif

ifneq ($(wildcard ${DEBDIR}/changelog),)

.PHONY: debcopy deb

DEBPACKAGEVERSION:=$(shell head -n 1 ${DEBDIR}/changelog | awk '{ print $$2 }' | tr -d '[()]')
DEBVERSION=$(firstword $(subst -, ,${DEBPACKAGEVERSION}))
DEBBUILD=$(lastword $(subst -, ,${DEBPACKAGEVERSION}))
DEBSRC=${PACKAGE_NAME}-${DEBVERSION}
DEBSRCDIR=${BUILDDIR}/${DEBSRC}
DEBSRC_ORIG=${PACKAGE_NAME}_${DEBVERSION}.orig
BUILDDATE=$(shell /bin/date --utc +%Y%m%d)
ifdef MENTORS
DEB_BUILDPKG_OPT=-sa
else
DEB_BUILDPKG_OPT=
endif
ifeq (${DEBBUILD},0)
DEBUSESVN=1
endif
ifeq (${DEBBUILD},1)
DEBUSESVN=1
endif
ifdef SNAPSHOT
DEBUSESVN=1
endif
ifndef SIGN
DEB_BUILDPKG_OPT+= -us -uc
endif

debcheck:
ifneq ($(DEBVERSION),$(PACKAGE_VERSION))
	! ${ECHO} "Debian version ($(DEBVERSION)) is not correct, expect $(PACKAGE_VERSION)"
endif
ifeq ($(wildcard ${DEBSRC_ORIG}.tar.gz),)
ifndef DEBUSESVN
	! ${ECHO} 'Need "${DEBSRC_ORIG}.tar.gz" to build for DEBBUILD = "${DEBBUILD}" > 1'
endif
endif

debcopy: distclean
	${DELTREE} ${BUILDDIR}
	${MKDIRTREE} ${DEBSRCDIR}
ifdef DEBUSESVN
	$(LINKTREE) -t $(DEBSRCDIR) \
		Makefile.fpc COPYING.* README.txt \
		components \
		converter \
		debugger \
		designer \
		doceditor \
		docs \
		install \
		examples \
		ide \
		images \
		languages \
		lazarus.app \
		lcl \
		packager \
		test \
		tools
	# add ide/revision.inc
	echo "const RevisionStr = '${SVNVERSION}';" > $(DEBSRCDIR)/ide/revision.inc
else
	tar -C ${BUILDDIR} -zxf ${DEBSRC_ORIG}.tar.gz ${DEBSRC}
	${DELTREE} $(DEBSRCDIR)/debian
endif

debsetup:
	$(COPYTREE) ${DEBDIR} $(DEBSRCDIR)/debian
ifdef SNAPSHOT
	sed -e 's/${DEBPACKAGEVERSION}/${DEBPACKAGEVERSION}~${BUILDDATE}/' -i $(DEBSRCDIR)/debian/changelog
endif
	chmod 755 $(DEBSRCDIR)/debian/rules
	find $(DEBSRCDIR) -name '.svn' | xargs ${DELTREE}

debbuild:
	cd ${DEBSRCDIR} ; dpkg-buildpackage ${DEB_BUILDPKG_OPT}

debcheckpolicy:
ifdef LINTIAN
	cd ${DEBSRCDIR} ; lintian -I -i ../*.changes
endif

debclean:
ifndef DEBUSESVN
	${DEL} ${BUILDDIR}/${DEBSRC_ORIG}.tar.gz
endif
	mv -v -t . \
	$(DEBSRCDIR)/../*.changes \
	$(DEBSRCDIR)/../*.deb \
	$(DEBSRCDIR)/../*.dsc \
	$(DEBSRCDIR)/../*.gz
	${DELTREE} $(DEBSRCDIR)
	rmdir $(BUILDDIR)

deb: debcheck debcopy deborigtargz debsetup debbuild debcheckpolicy debclean

deborigtargz:
ifdef DEBUSESVN
	#$(MAKE) fpc_zipinstall USETAR=y ZIPTARGET=debcopy PACKDIR=$(DEBSRCDIR) FULLZIPNAME=${DEBSRC_ORIG}
	tar -C ${BUILDDIR} -zcf ${BUILDDIR}/${DEBSRC_ORIG}.tar.gz --exclude-vcs ${DEBSRC}
else
	${LINKTREE} ${DEBSRC_ORIG}.tar.gz ${BUILDDIR}/${DEBSRC_ORIG}.tar.gz
endif

endif   # changelog found

endif