lazarus/Makefile.fpc
vincents 19935e9ab8 fixed installing man files (issue #12580)
git-svn-id: trunk@17269 -
2008-11-07 19:28:03 +00:00

236 lines
6.3 KiB
Makefile

#
# Makefile.fpc for Lazarus for Free Pascal
#
[package]
name=lazarus
version=$(IDEVERSION)
[require]
packages=regexpr
[target]
programs=lazarus startlazarus
dirs=lcl components packager/registration ideintf designer packager
exampledirs=examples
[compiler]
[clean]
files=$(wildcard *$(OEXT)) $(wildcard *$(PPUEXT)) $(wildcard *$(RSTEXT))
[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: lcl components packager/registration ideintf packager bigidecomponents ide idepkg idebig bigide starter lazbuilder tools all clean cleanide purge examples install lazbuild
#-----------------------------------------------------------------------------
ide:
$(MAKE) -C ide ide
#-----------------------------------------------------------------------------
idepkg:
$(MAKE) -C ide idepkg
#-----------------------------------------------------------------------------
bigide: lcl packager/registration ideintf designer packager bigidecomponents idebig starter
#-----------------------------------------------------------------------------
idebig:
$(MAKE) -C ide bigide
#-----------------------------------------------------------------------------
bigidecomponents:
$(MAKE) -C components bigidecomponents
#-----------------------------------------------------------------------------
bigideclean: cleanlaz
$(MAKE) -C components bigideclean
#-----------------------------------------------------------------------------
starter:
$(MAKE) -C ide starter
#-----------------------------------------------------------------------------
lazbuild: lazbuilder
lazbuilder:
$(MAKE) -C ide lazbuilder
#-----------------------------------------------------------------------------
tools: lcl components
$(MAKE) -C tools
#-----------------------------------------------------------------------------
examples: lcl components
#-----------------------------------------------------------------------------
all: lcl components packager/registration ideintf designer packager ide starter lazbuilder
#-----------------------------------------------------------------------------
cleanide:
$(MAKE) -C ide cleanide
cleanlaz: cleanide
$(MAKE) -C lcl clean
$(MAKE) -C components clean
$(MAKE) -C packager clean
$(MAKE) -C designer clean
$(MAKE) -C ideintf clean
purge: cleanlaz
$(MAKE) -C examples clean
$(MAKE) -C tools clean
# $(MAKE) -C doceditor clean
$(MAKE) -C tools clean
clean: cleanlaz
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 C expect 'make install' to copy the binaries to somewhere
# Copy the lazarus tree to the install directory and set a link
install:
$(MAKE) installbase
$(COPYTREE) . $(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
##########################################################################
ifeq ($(OS_TARGET),linux)
ifndef DEBDIR
DEBDIR=debian
endif
# Build dir
ifndef BUILDDIR
BUILDDIR=$(BASEDIR)/build
endif
# Link Tree
ifdef LINKISCOPY
ifndef LINKTREE
LINKTREE:=$(CPPROG) -Rfp
endif
else
ifndef LINKTREE
LINKTREE:=$(CPPROG) -Rfpl
endif
endif
ifndef SVNREVISION
SVNREVISION=$(svnversion) $(BASEDIR)
endif
ifneq ($(wildcard ${DEBDIR}/changelog),)
.PHONY: debcopy deb
DEBPACKAGEVERSION:=$(shell head -n 1 ${DEBDIR}/changelog | awk '{ print $$2 }' | tr -d '[()]')
DEBFPCVERSION:=$(shell echo $(DEBPACKAGEVERSION) | awk -F '-' '{ print $$1 }')
DEBSRCDIR:=$(BUILDDIR)/lazarus-$(DEBFPCVERSION)
debcheck:
ifneq ($(DEBFPCVERSION),$(PACKAGE_VERSION))
@$(ECHO) "Debian version ($(DEBFPCVERSION)) is not correct, expect $(PACKAGE_VERSION)"
@exit 1
endif
debcopy: distclean
rm -rf ${BUILDDIR}
install -d $(DEBSRCDIR)
$(LINKTREE) ${DEBDIR} $(DEBSRCDIR)/debian
$(LINKTREE) Makefile.fpc $(DEBSRCDIR)
$(LINKTREE) COPYING.* $(DEBSRCDIR)
$(LINKTREE) README.txt $(DEBSRCDIR)
$(LINKTREE) components $(DEBSRCDIR)
$(LINKTREE) converter $(DEBSRCDIR)
$(LINKTREE) debugger $(DEBSRCDIR)
$(LINKTREE) designer $(DEBSRCDIR)
$(LINKTREE) doceditor $(DEBSRCDIR)
ifndef NODOCS
$(LINKTREE) docs $(DEBSRCDIR)
endif
$(LINKTREE) install $(DEBSRCDIR)
$(LINKTREE) examples $(DEBSRCDIR)
$(LINKTREE) ide $(DEBSRCDIR)
$(LINKTREE) ideintf $(DEBSRCDIR)
$(LINKTREE) images $(DEBSRCDIR)
$(LINKTREE) languages $(DEBSRCDIR)
$(LINKTREE) lazarus.app $(DEBSRCDIR)
$(LINKTREE) lcl $(DEBSRCDIR)
$(LINKTREE) packager $(DEBSRCDIR)
$(LINKTREE) test $(DEBSRCDIR)
$(LINKTREE) tools $(DEBSRCDIR)
# add ide/revision.inc
echo "const RevisionStr = '${SVNVERSION}';" > $(DEBSRCDIR)/ide/revision.inc
find $(DEBSRCDIR) -name 'CVS*' | xargs -n1 rm -rf
find $(DEBSRCDIR) -name '.svn' | xargs -n1 rm -rf
chmod 755 $(DEBSRCDIR)/debian/rules
debbuild:
ifdef NODOCS
cd $(DEBSRCDIR) ; dpkg-buildpackage -us -uc -B
else
cd $(DEBSRCDIR) ; dpkg-buildpackage -us -uc
endif
mv -v -t . $(DEBSRCDIR)/../*.{deb,dsc,changes,tar.gz}
debclean:
rm -rf $(DEBSRCDIR)
rmdir $(BUILDDIR)
deb: debcheck debcopy debbuild debclean
endif # changelog found
endif