Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/tcl8.5.2/macosx/GNUmakefile @ 25

Last change on this file since 25 was 25, checked in by landauf, 17 years ago

added tcl to libs

File size: 7.2 KB
Line 
1########################################################################################################
2#
3# Makefile wrapper to build tcl on Mac OS X in a way compatible with the tk/macosx Xcode buildsystem
4#       uses the standard unix build system in tcl/unix (which can be used directly instead of this
5#       if you are not using the tk/macosx projects).
6#
7# Copyright (c) 2002-2008 Daniel A. Steffen <das@users.sourceforge.net>
8#
9# See the file "license.terms" for information on usage and redistribution of
10# this file, and for a DISCLAIMER OF ALL WARRANTIES.
11#
12# RCS: @(#) $Id: GNUmakefile,v 1.9 2008/03/11 22:28:34 das Exp $
13#
14########################################################################################################
15
16#-------------------------------------------------------------------------------------------------------
17# customizable settings
18
19DESTDIR                 ?=
20INSTALL_ROOT            ?= ${DESTDIR}
21
22BUILD_DIR               ?= ${CURDIR}/../../build
23SYMROOT                 ?= ${BUILD_DIR}/${PROJECT}
24OBJROOT                 ?= ${SYMROOT}
25
26EXTRA_CONFIGURE_ARGS    ?=
27EXTRA_MAKE_ARGS         ?=
28
29INSTALL_PATH            ?= /Library/Frameworks
30PREFIX                  ?= /usr/local
31BINDIR                  ?= ${PREFIX}/bin
32LIBDIR                  ?= ${INSTALL_PATH}
33MANDIR                  ?= ${PREFIX}/man
34
35# set to non-empty value to install manpages in addition to html help:
36INSTALL_MANPAGES        ?=
37
38#-------------------------------------------------------------------------------------------------------
39# meta targets
40
41meta                    := all install embedded install-embedded clean distclean test
42
43styles                  := develop deploy
44
45all                     := ${styles}
46all                     : ${all}
47
48install                 := ${styles:%=install-%}
49install                 : ${install}
50install-%:              action := install-
51
52embedded                := ${styles:%=embedded-%}
53embedded                : embedded-deploy
54install-embedded        := ${embedded:%=install-%}
55install-embedded        : install-embedded-deploy
56
57clean                   := ${styles:%=clean-%}
58clean                   : ${clean}
59clean-%:                action := clean-
60distclean               := ${styles:%=distclean-%}
61distclean               : ${distclean}
62distclean-%:            action := distclean-
63
64test                    := ${styles:%=test-%}
65test                    : ${test}
66test-%:                 action := test-
67
68targets                 := $(foreach v,${meta},${$v})
69
70#-------------------------------------------------------------------------------------------------------
71# build styles
72
73BUILD_STYLE             =
74CONFIGURE_ARGS          =
75OBJ_DIR                 = ${OBJROOT}/${BUILD_STYLE}
76
77empty                   :=
78space                   := ${empty} ${empty}
79objdir                  := $(subst ${space},\ ,${OBJ_DIR})
80
81develop_make_args       := BUILD_STYLE=Development CONFIGURE_ARGS=--enable-symbols
82deploy_make_args        := BUILD_STYLE=Deployment INSTALL_TARGET=install-strip \
83                           EXTRA_CFLAGS=-DNDEBUG
84embedded_make_args      := EMBEDDED_BUILD=1
85install_make_args       := INSTALL_BUILD=1
86
87${targets}:
88        ${MAKE} ${action}${PROJECT} \
89        $(foreach s,${styles} embedded install,$(if $(findstring $s,$@),${${s}_make_args}))
90
91#-------------------------------------------------------------------------------------------------------
92# project specific settings
93
94PROJECT                 := tcl
95PRODUCT_NAME            := Tcl
96
97UNIX_DIR                := ${CURDIR}/../unix
98VERSION                 := $(shell awk -F= '/^TCL_VERSION/ {print $$2; nextfile}' ${UNIX_DIR}/configure.in)
99TCLSH                   := tclsh${VERSION}
100
101BUILD_TARGET            := all tcltest
102INSTALL_TARGET          := install
103
104export CPPROG           := cp -p
105
106INSTALL_TARGETS         = install-binaries install-libraries
107ifeq (${EMBEDDED_BUILD},)
108INSTALL_TARGETS         += install-private-headers
109endif
110ifeq (${INSTALL_BUILD}_${EMBEDDED_BUILD}_${BUILD_STYLE},1__Deployment)
111INSTALL_TARGETS         += html-tcl
112ifneq (${INSTALL_MANPAGES},)
113INSTALL_TARGETS         += install-doc
114endif
115endif
116
117MAKE_VARS               := INSTALL_ROOT INSTALL_TARGETS VERSION GENERIC_FLAGS
118MAKE_ARGS_V             = $(foreach v,${MAKE_VARS},$v='${$v}')
119
120build-${PROJECT}:       target = ${BUILD_TARGET}
121install-${PROJECT}:     target = ${INSTALL_TARGET}
122clean-${PROJECT} distclean-${PROJECT} test-${PROJECT}: \
123                        target = $*
124
125DO_MAKE                 = +${MAKE} -C "${OBJ_DIR}" ${target} ${MAKE_ARGS_V} ${MAKE_ARGS} ${EXTRA_MAKE_ARGS}
126
127#-------------------------------------------------------------------------------------------------------
128# build rules
129
130${PROJECT}:
131        ${MAKE} install-${PROJECT} INSTALL_ROOT="${OBJ_DIR}/"
132
133${objdir}/Makefile: ${UNIX_DIR}/Makefile.in ${UNIX_DIR}/configure \
134                     ${UNIX_DIR}/tclConfig.sh.in Tcl-Info.plist.in
135        mkdir -p "${OBJ_DIR}" && cd "${OBJ_DIR}" && \
136        if [ ${UNIX_DIR}/configure -nt config.status ]; then ${UNIX_DIR}/configure -C \
137        --prefix="${PREFIX}" --bindir="${BINDIR}" --libdir="${LIBDIR}" \
138        --mandir="${MANDIR}" --enable-threads --enable-framework --enable-dtrace \
139        ${CONFIGURE_ARGS} ${EXTRA_CONFIGURE_ARGS}; else ./config.status; fi
140
141build-${PROJECT}: ${objdir}/Makefile
142        ${DO_MAKE}
143ifeq (${INSTALL_BUILD},)
144# symolic link hackery to trick
145# 'make install INSTALL_ROOT=${OBJ_DIR}'
146# into building Tcl.framework and tclsh in ${SYMROOT}
147        @cd "${OBJ_DIR}" && mkdir -p $(dir $(subst ${space},\ ,./${LIBDIR})) $(dir $(subst ${space},\ ,./${BINDIR})) "${SYMROOT}" && \
148        rm -f "./${LIBDIR}" "./${BINDIR}" && ln -fs "${SYMROOT}" "./${LIBDIR}" && \
149        ln -fs "${SYMROOT}" "./${BINDIR}" && ln -fs "${OBJ_DIR}/tcltest" "${SYMROOT}"
150endif
151
152install-${PROJECT}: build-${PROJECT}
153ifeq (${EMBEDDED_BUILD}_${INSTALL_ROOT},1_)
154        @echo "Cannot install-embedded with empty INSTALL_ROOT !" && false
155endif
156ifeq (${EMBEDDED_BUILD},1)
157        @rm -rf "${INSTALL_ROOT}/${LIBDIR}/Tcl.framework"
158endif
159        ${DO_MAKE}
160ifeq (${INSTALL_BUILD},1)
161ifeq (${EMBEDDED_BUILD},1)
162# if we are embedding frameworks, don't install tclsh
163        @rm -f "${INSTALL_ROOT}${BINDIR}/${TCLSH}" && \
164        rmdir -p "${INSTALL_ROOT}${BINDIR}" 2>&- || true
165else
166# redo prebinding (when not building for Mac OS X 10.4 or later only)
167        @if [ "`echo "$${MACOSX_DEPLOYMENT_TARGET}" | \
168        awk -F '10\\.' '{print int($$2)}'`" -lt 4 -a "`echo "$${CFLAGS}" | \
169        awk -F '-mmacosx-version-min=10\\.' '{print int($$2)}'`" -lt 4 ]; \
170        then cd ${INSTALL_ROOT}/; \
171        if [ ! -d usr/lib ]; then mkdir -p usr && ln -fs /usr/lib usr/ && RM_USRLIB=1; fi; \
172        if [ ! -d System ]; then ln -fs /System . && RM_SYSTEM=1; fi; \
173        redo_prebinding -r . "./${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}/${PRODUCT_NAME}"; \
174        redo_prebinding -r . "./${BINDIR}/${TCLSH}"; \
175        if [ -n "$${RM_USRLIB:-}" ]; then rm -f usr/lib; rmdir -p usr 2>&-; fi; \
176        if [ -n "$${RM_SYSTEM:-}" ]; then rm -f System; fi; fi
177# install tclsh symbolic link
178        @ln -fs ${TCLSH} "${INSTALL_ROOT}${BINDIR}/tclsh"
179endif
180endif
181ifeq (${BUILD_STYLE}_${EMBEDDED_BUILD},Development_)
182# keep copy of debug library around, so that
183# Deployment build can be installed on top
184# of Development build without overwriting
185# the debug library
186        @cd "${INSTALL_ROOT}${LIBDIR}/${PRODUCT_NAME}.framework/Versions/${VERSION}" && \
187        ln -f "${PRODUCT_NAME}" "${PRODUCT_NAME}_debug"
188endif
189
190clean-${PROJECT}: %-${PROJECT}:
191        ${DO_MAKE}
192        rm -rf "${SYMROOT}"/{${PRODUCT_NAME}.framework,${TCLSH},tcltest}
193        rm -f "${OBJ_DIR}"{"${LIBDIR}","${BINDIR}"} && \
194        rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${LIBDIR})) 2>&- || true && \
195        rmdir -p "${OBJ_DIR}"$(dir $(subst ${space},\ ,${BINDIR})) 2>&- || true
196
197distclean-${PROJECT}: %-${PROJECT}: clean-${PROJECT}
198        ${DO_MAKE}
199        rm -rf "${OBJ_DIR}"
200
201test-${PROJECT}: %-${PROJECT}: build-${PROJECT}
202        ${DO_MAKE}
203
204#-------------------------------------------------------------------------------------------------------
205
206.PHONY: ${meta} ${targets} ${PROJECT} build-${PROJECT} install-${PROJECT} \
207        clean-${PROJECT} distclean-${PROJECT}
208
209.NOTPARALLEL:
210
211#-------------------------------------------------------------------------------------------------------
Note: See TracBrowser for help on using the repository browser.