1## 2# Makefile support for building Tcl extensions 3## 4# Daniel A. Steffen <das@users.sourceforge.net> 5## 6 7## 8# CoreOS Makefile settings common to all Tcl extensions 9## 10 11UserType = Developer 12ToolType = Libraries 13 14ifneq ($(Configure),:) 15Configure_Products += config.log 16else 17Configure_Products = . 18endif 19 20# avoid complaints about non-existing SYMROOT 21configure:: 22 $(_v)- $(MKDIR) $(SYMROOT) 23 24ifndef CoreOSMakefiles 25include $(MAKEFILEPATH)/CoreOS/ReleaseControl/GNUSource.make 26endif 27 28Install_Flags = DESTDIR="$(DSTROOT)" $(Extra_Install_Flags) 29Install_Target = install 30 31## 32# Definitions used by all Tcl extensions 33## 34 35TclExtLibDir = $(NSLIBRARYDIR)/Tcl 36TclExtManDir = $(MANDIR)/mann 37 38Tclsh = $(USRBINDIR)/tclsh 39TclFramework = $(NSFRAMEWORKDIR)/Tcl.framework 40TclHeaders = $(TclFramework)/Headers 41TclPrivateHeaders = $(TclFramework)/PrivateHeaders 42 43Wish = $(USRBINDIR)/wish 44TkFramework = $(NSFRAMEWORKDIR)/Tk.framework 45TkHeaders = $(TkFramework)/Headers 46TkPrivateHeaders = $(TkFramework)/PrivateHeaders 47 48TclExtDir = $(Project) 49TclExtStubConfig = $(TclExtDir)Config.sh 50 51TEA_Configure_Flags = --libdir=$(TclExtLibDir) \ 52 --with-tcl=$(TclFramework) \ 53 --with-tk=$(TkFramework) \ 54 --enable-threads \ 55 $(Extra_TEA_Configure_Flags) 56TEA_Environment = TCLSH_PROG=$(Tclsh) \ 57 $(Extra_TEA_Environment) 58TEA_TclConfig = $(SRCROOT)/../tclconfig 59 60export PATH := $(shell dirname $(Tclsh)):$(shell dirname $(Wish)):$(PATH) 61export DYLD_FRAMEWORK_PATH := $(shell dirname $(TclFramework)):$(shell dirname $(TkFramework)) 62 63## 64# Common cleanup actions 65## 66 67# Remove empty directories from DSTROOT after install 68Find_Cruft := '(' '(' $(Find_Cruft) ')' -or '(' -mindepth 1 -type d -empty -print ')' ')' 69 70# strip installed extension libraries, fix install_name, delete stub library 71strip:: 72 $(_v) shopt -s nullglob && cd "$(DSTROOT)" && \ 73 $(RM) -f "./$(TclExtLibDir)"/$(TclExtDir)*/lib*stub*.a && \ 74 $(CP) "./$(TclExtLibDir)"/$(TclExtDir)*/*.dylib "$(SYMROOT)" && \ 75 $(STRIP) -S "./$(TclExtLibDir)"/$(TclExtDir)*/*.{dylib,a} && \ 76 for f in "./$(TclExtLibDir)"/$(TclExtDir)*/*.dylib; do \ 77 install_name_tool -id "$${f:2}" "$${f}"; done && \ 78 cd "$(SYMROOT)" && for f in *.dylib; do $(DSYMUTIL) "$${f}"; done 79 80# delete stub config file 81fix-config: 82 $(_v) $(RM) -f "$(DSTROOT)/$(TclExtLibDir)"/$(TclExtStubConfig) 83 84# fix permissions and owner after install 85fix-perms:: 86 $(_v)- $(CHOWN) -R $(Install_User):$(Install_Group) $(DSTROOT) 87 $(_v)- $(FIND) "$(DSTROOT)/$(TclExtLibDir)"/$(TclExtDir)* -type f ! -name "*.dylib" -perm -+x -print0 | $(XARGS) -0 $(CHMOD) -x 88 $(_v)- $(FIND) "$(DSTROOT)/$(TclExtLibDir)"/$(TclExtDir)* -type f -name "*.dylib" ! -perm -+x -print0 | $(XARGS) -0 $(CHMOD) +x 89 $(_v)- $(FIND) $(DSTROOT) -type f ! -perm -+x ! -perm $(Install_File_Mode) -print0 | $(XARGS) -0 $(CHMOD) $(Install_File_Mode) 90 $(_v)- $(FIND) $(DSTROOT) -type f -perm -+x ! -perm $(Install_Program_Mode) -print0 | $(XARGS) -0 $(CHMOD) $(Install_Program_Mode) 91 $(_v)- $(FIND) $(DSTROOT) -type d ! -perm $(Install_Directory_Mode) -print0 | $(XARGS) -0 $(CHMOD) $(Install_Directory_Mode) 92 93.PHONY: strip install-doc fix-config fix-perms 94.NOTPARALLEL: 95 96include ../Fetch.make 97