From: Apple Date: Wed, 23 Apr 2008 00:10:42 +0000 (+0000) Subject: CoreOSMakefiles-52.tar.gz X-Git-Tag: mac-os-x-1056^0 X-Git-Url: https://git.saurik.com/apple/coreosmakefiles.git/commitdiff_plain/611bdc3fb27e5d8406bc58b30062b4088037ab5f CoreOSMakefiles-52.tar.gz --- diff --git a/ReleaseControl/BSDCommon.make b/ReleaseControl/BSDCommon.make index d1af115..af2989a 100644 --- a/ReleaseControl/BSDCommon.make +++ b/ReleaseControl/BSDCommon.make @@ -30,6 +30,9 @@ include $(MAKEFILEPATH)/CoreOS/ReleaseControl/Common.make ### ### Library_Prefix ?= lib +RELEASE_Library_Suffix = $(Library_Suffix) +DEBUG_Library_Suffix = _debug$(Library_Suffix) +PROFILE_Library_Suffix = _profile$(Library_Suffix) ProductType ?= tool ifeq ($(ProductType),tool) @@ -38,20 +41,40 @@ ifeq ($(ProductType),tool) else ifeq ($(ProductType),dylib) Library_Suffix ?= .dylib - ProductName ?= $(Library_Prefix)$(Project)$(if $(Library_Version),.$(Library_Version),)$(Library_Suffix) - ProductNameNoVersion ?= $(Library_Prefix)$(Project)$(Library_Suffix) + ProductName ?= $(Library_Prefix)$(Project)$(Library_Suffix) + ProductNameWithVersion ?= $(Library_Prefix)$(Project)$(if $(Library_Version),.$(Library_Version),)$(Library_Suffix) + RELEASE_ProductName = $(ProductName) + RELEASE_ProductNameWithVersion = $(ProductNameWithVersion) + DEBUG_ProductName = $(ProductName:$(Library_Suffix)=$(DEBUG_Library_Suffix)) + DEBUG_ProductNameWithVersion = $(ProductNameWithVersion:$(Library_Suffix)=$(DEBUG_Library_Suffix)) + PROFILE_ProductName = $(ProductName:$(Library_Suffix)=$(PROFILE_Library_Suffix)) + PROFILE_ProductNameWithVersion = $(ProductNameWithVersion:$(Library_Suffix)=$(PROFILE_Library_Suffix)) Install_Dir ?= /usr/lib else ifeq ($(ProductType),staticlib) Library_Suffix ?= .a ProductName ?= $(Library_Prefix)$(Project)$(Library_Suffix) + RELEASE_ProductName = $(ProductName) + DEBUG_ProductName = $(ProductName:$(Library_Suffix)=$(DEBUG_Library_Suffix)) + PROFILE_ProductName = $(ProductName:$(Library_Suffix)=$(PROFILE_Library_Suffix)) Install_Dir ?= /usr/local/lib else + ifeq ($(ProductType),none) + else $(error Unknown ProductType: $(ProductType)) + endif endif endif endif +BUILD_STYLES = RELEASE +ifeq ($(BuildDebug),YES) +BUILD_STYLES += DEBUG +endif +ifeq ($(BuildProfile),YES) +BUILD_STYLES += PROFILE +endif + ALL_FILES = $(CFILES) $(MFILES) $(CXXFILES) $(USERDEFS) $(SERVERDEFS) $(MANPAGES) ALL_SRCFILES = $(CFILES) $(MFILES) $(CXXFILES) @@ -78,6 +101,13 @@ ifneq ($(RPCSVCFILES),) CFILES += $(foreach FILE, $(RPCFILES:.x=_svc.c), $(OBJROOT)/$(Project)/$(notdir $(FILE))) endif +## Lex ## + +LFLAGS=$(Extra_L_Flags) +ifneq ($(LFILES),) +CFILES += $(foreach FILE, $(LFILES:.l=.yy.c), $(OBJROOT)/$(Project)/$(notdir $(FILE))) +endif + ## Yacc ## YFLAGS=$(Extra_Y_Flags) @@ -92,12 +122,6 @@ Extra_CC_Flags += -isysroot $(SDKROOT) Extra_LD_Flags += -Wl,-syslibroot,$(SDKROOT) endif -ifneq ($(RC_TARGET_CONFIG),) -ifeq ($(shell tconf --product),) -$(error undefined Target Config: $(RC_TARGET_CONFIG)) -endif -endif - ## Dylib Support ## ifeq ($(Library_Compatibility_Version),) @@ -107,12 +131,27 @@ ifeq ($(Library_Current_Version),) Library_Current_Version = $(if $(RC_ProjectSourceVersion), $(RC_ProjectSourceVersion), 1) endif -ALL_OFILES = $(foreach OFILE, \ +RELEASE_OFILE_SUFFIX=.o +DEBUG_OFILE_SUFFIX=_debug.o +PROFILE_OFILE_SUFFIX=_profile.o + +RELEASE_ALL_OFILES = $(foreach OFILE, \ $(CFILES:.c=.o) \ $(MFILES:.m=.o) \ $(CXXFILES:.%=.o) \ $(OTHER_OFILES), \ $(OBJROOT)/$(Project)/$(notdir $(OFILE))) +DEBUG_ALL_OFILES = $(RELEASE_ALL_OFILES:.o=$(DEBUG_OFILE_SUFFIX)) +PROFILE_ALL_OFILES = $(RELEASE_ALL_OFILES:.o=$(PROFILE_OFILE_SUFFIX)) +ALL_OFILES = $(RELEASE_ALL_OFILES) $(DEBUG_ALL_OFILES) $(PROFILE_ALL_OFILES) + +RELEASE_CFLAGS = $(CFLAGS) +DEBUG_CFLAGS = $(CFLAGS) -DDEBUG +PROFILE_CFLAGS = $(CFLAGS) -pg -DPROFILE + +RELEASE_LDFLAGS = $(LDFLAGS) +DEBUG_LDFLAGS = $(LDFLAGS) +PROFILE_LDFLAGS = $(LDFLAGS) ### ### ### Targets ### @@ -123,7 +162,13 @@ ALL_OFILES = $(foreach OFILE, \ Install_Headers_Directory ?= /usr/include Install_Private_Headers_Directory ?= /usr/local/include -installhdrs:: +installhdrs:: _installhdrs +ifneq ($(SubProjects),) + make recurse TARGET=$@ RC_ARCHS="$(RC_ARCHS)" +endif + +_installhdrs:: + @true # avoid nothing to be done warning ifneq ($(Install_Headers),) @echo "Installing headers for $(Project)..." $(INSTALL_DIRECTORY) $(DSTROOT)/$(Install_Headers_Directory) @@ -141,30 +186,38 @@ ifneq ($(Install_Private_Headers),) done endif -install:: build installhdrs - @echo "Installing $(Project)..." -ifneq ($(SubProjects),) - make recurse TARGET=install RC_ARCHS="$(RC_ARCHS)" -else +install:: build _installhdrs + @echo "====== Installing $(Project) =====" +#ifneq ($(SubProjects),) +# make recurse TARGET=$@ RC_ARCHS="$(RC_ARCHS)" +#endif $(INSTALL_DIRECTORY) $(DSTROOT)/$(Install_Dir) -ifneq ($(ALL_OFILES),) +ifneq ($(strip $(ALL_OFILES)),) ifeq ($(ProductType),tool) $(INSTALL_PROGRAM) $(SYMROOT)/$(ProductName) $(DSTROOT)/$(Install_Dir) else ifeq ($(ProductType),dylib) - $(INSTALL_DYLIB) $(SYMROOT)/$(ProductName) $(DSTROOT)/$(Install_Dir) - $(STRIP) -S $(DSTROOT)/$(Install_Dir)/$(ProductName) - ifneq ($(ProductName),$(ProductNameNoVersion)) - $(LN) -sf $(ProductName) $(DSTROOT)/$(Install_Dir)/$(ProductNameNoVersion) - endif + @$(foreach STYLE, $(BUILD_STYLES), \ + CMD="$(INSTALL_DYLIB) $(SYMROOT)/$($(STYLE)_ProductNameWithVersion) \ + $(DSTROOT)/$(Install_Dir)" ; \ + echo $${CMD} ; $${CMD} || exit 1 ; \ + CMD="$(STRIP) -S $(DSTROOT)/$(Install_Dir)/$($(STYLE)_ProductNameWithVersion)" ; \ + echo $${CMD} ; $${CMD} || exit 1 ; \ + if [ "$($(STYLE)_ProductName)" != "$($(STYLE)_ProductNameWithVersion)" ]; then \ + CMD="$(LN) -sf $($(STYLE)_ProductNameWithVersion) \ + $(DSTROOT)/$(Install_Dir)/$($(STYLE)_ProductName)" ; \ + echo $${CMD} ; $${CMD} || exit 1 ; \ + fi ; ) else ifeq ($(ProductType),staticlib) - $(INSTALL_LIBRARY) $(SYMROOT)/$(ProductName) $(DSTROOT)/$(Install_Dir) + @$(foreach STYLE, $(BUILD_STYLES), \ + CMD="$(INSTALL_LIBRARY) $(SYMROOT)/$($(STYLE)_ProductName) \ + $(DSTROOT)/$(Install_Dir)" ; \ + echo $${CMD} ; $${CMD} || exit 1 ; ) endif endif endif endif -endif ifneq ($(MANPAGES),) @make install-man-pages endif @@ -213,6 +266,16 @@ rpcfiles: echo $${CMD} ; $${CMD} || exit 1; \ done +lfiles: + @$(MKDIR) $(OBJROOT)/$(Project) + @for FILE in $(LFILES); do \ + OUT=`basename $${FILE} .l` ; \ + CMD="$(LEX) $(LFLAGS) \ + --header-file=$(OBJROOT)/$(Project)/$${OUT}.yy.h \ + -o $(OBJROOT)/$(Project)/$${OUT}.yy.c $${FILE}"; \ + echo $${CMD} ; $${CMD} || exit 1; \ + done + yfiles: @$(MKDIR) $(OBJROOT)/$(Project) @for FILE in $(YFILES); do \ @@ -222,38 +285,56 @@ yfiles: echo $${CMD} ; $${CMD} || exit 1 ; \ done -build:: migdefs rpcfiles yfiles $(ALL_FILES) - @echo "Building $(Project)..." +build:: migdefs rpcfiles yfiles lfiles $(ALL_FILES) +ifneq ($(SubProjects),) + make recurse TARGET=install RC_ARCHS="$(RC_ARCHS)" +endif @$(MKDIR) $(OBJROOT)/$(Project) @$(MKDIR) $(SYMROOT) - @for CFILE in $(ALL_SRCFILES); do \ - OFILE=$$(echo $$(basename $${CFILE}) | sed -e 's,\.[^.]*$$,.o,') ; \ - CMD="$(CC) $(CFLAGS) -c -o $(OBJROOT)/$(Project)/$${OFILE} $${CFILE}" ; \ + @$(foreach STYLE, $(BUILD_STYLES), \ + echo ===== Building $(ProductName) $(STYLE) ===== ; \ + for CFILE in $(ALL_SRCFILES); do \ + OFILE=$(OBJROOT)/$(Project)/$$(echo $$(basename $${CFILE}) | \ + sed -e 's,\.[^.]*$$,$($(STYLE)_OFILE_SUFFIX),') ; \ + if [ ! "$${OFILE}" -nt "$${CFILE}" ]; then \ + CMD="$(CC) $($(STYLE)_CFLAGS) -c -o $${OFILE} $${CFILE}" ; \ echo $$CMD ; $$CMD || exit 1 ; \ - done + fi ; \ + done ; ) -ifneq ($(ALL_OFILES),) +ifneq ($(strip $(ALL_OFILES)),) ifeq ($(ProductType),tool) - $(CC) $(LDFLAGS) -o $(SYMROOT)/$(ProductName) $(ALL_OFILES) + @echo ===== Linking $(ProductName) RELEASE ===== + $(CC) $(RELEASE_LDFLAGS) -o $(SYMROOT)/$(ProductName) \ + $(RELEASE_ALL_OFILES) + dsymutil --out $(SYMROOT)/$(ProductName).dSYM \ + $(SYMROOT)/$(ProductName) || true else ifeq ($(ProductType),dylib) - $(CC) -dynamiclib $(LDFLAGS) \ + @$(foreach STYLE, $(BUILD_STYLES), \ + echo ===== Linking $(ProductName) $(STYLE) ===== ; \ + CMD="$(CC) -dynamiclib $($(STYLE)_LDFLAGS) \ -dynamic \ -compatibility_version $(Library_Compatibility_Version) \ -current_version $(Library_Current_Version) \ - -install_name `echo $(Install_Dir)/$(ProductName) | sed 's,//,/,g'` \ - -o $(SYMROOT)/$(ProductName) \ - $(ALL_OFILES) + -install_name `echo $(Install_Dir)/$($(STYLE)_ProductNameWithVersion) | sed 's,//,/,g'` \ + -o $(SYMROOT)/$($(STYLE)_ProductNameWithVersion) \ + $($(STYLE)_ALL_OFILES)" ; \ + echo $${CMD} ; $${CMD} || exit 1 ; \ + CMD="dsymutil --out $(SYMROOT)/$($(STYLE)_ProductNameWithVersion).dSYM \ + $(SYMROOT)/$($(STYLE)_ProductNameWithVersion)" ; \ + echo $${CMD} ; $${CMD} ; ) else ifeq ($(ProductType),staticlib) - $(LIBTOOL) -static -o $(SYMROOT)/$(ProductName) $(ALL_OFILES) + @$(foreach STYLE, $(BUILD_STYLES), \ + echo ===== Linking $(ProductName) $(STYLE) ===== ; \ + CMD="$(LIBTOOL) -static -o $(SYMROOT)/$($(STYLE)_ProductName) \ + $($(STYLE)_ALL_OFILES)" ; \ + echo $${CMD} ; $${CMD} || exit 1 ; ) endif endif endif - ifneq ($(ProductType),staticlib) - dsymutil --out $(SYMROOT)/$(ProductName).dSYM $(SYMROOT)/$(ProductName) || true - endif endif install-man-pages:: diff --git a/ReleaseControl/Common.make b/ReleaseControl/Common.make index 3fa7c95..5d849a3 100644 --- a/ReleaseControl/Common.make +++ b/ReleaseControl/Common.make @@ -111,13 +111,19 @@ ManPageDirectories = /usr/share/man # Targets ## -.PHONY: all install installhdrs install_headers lazy_installsrc lazy_install_source installsrc install_source build clean recurse +.PHONY: all install installhdrs install_headers lazy_installsrc lazy_install_source installsrc install_source build clean recurse _targetconfig all: build $(DSTROOT): install -install:: install_headers build +install:: _targetconfig install_headers build + +_targetconfig:: + @PRODUCT="`tconf --product 2>/dev/null`" ; \ + if [ -z "$$PRODUCT" ]; then \ + echo "Error: TargetConfig not defined" ; exit 1 ; \ + else echo "TargetConfig: $$PRODUCT" ; fi # For RC installhdrs:: install_headers @@ -162,7 +168,7 @@ build:: lazy_install_source clean:: @echo "Cleaning $(Project)..." - $(_v) $(RMDIR) -f "$(BuildDirectory)" + $(_v) $(RMDIR) -f "$(BuildDirectory)" || true $(Passed_Targets) $(Extra_Passed_Targets): $(_v) umask $(Install_Mask) ; $(MAKE) -C $(BuildDirectory) $(Environment) $@ @@ -171,6 +177,9 @@ recurse: ifdef SubProjects $(_v) for SubProject in $(SubProjects); do \ $(MAKE) -C $$SubProject $(TARGET) \ + OBJROOT=$(OBJROOT) \ + SYMROOT=$(SYMROOT) \ + DSTROOT=$(DSTROOT) \ BuildDirectory=$(BuildDirectory)/$${SubProject} \ Sources=$(Sources)/$${SubProject} \ CoreOSMakefiles=$(CoreOSMakefiles) || exit 1 ; \ diff --git a/ReleaseControl/GNUSource.make b/ReleaseControl/GNUSource.make index c7295f9..dd89bae 100644 --- a/ReleaseControl/GNUSource.make +++ b/ReleaseControl/GNUSource.make @@ -142,7 +142,8 @@ $(ConfigStamp): ifneq ($(GnuNoConfigure),YES) @echo "Configuring $(Project)..." $(_v) $(MKDIR) $(BuildDirectory) - $(_v) cd $(BuildDirectory) && $(Environment) $(Configure) $(Configure_Flags) +# Disable LD_TRACE_FILE during configure + $(_v) cd $(BuildDirectory) && $(Environment) LD_TRACE_FILE=/dev/null $(Configure) $(Configure_Flags) endif $(_v) touch $@ diff --git a/Standard/Variables.make b/Standard/Variables.make index 0f1a667..da21b77 100644 --- a/Standard/Variables.make +++ b/Standard/Variables.make @@ -70,7 +70,7 @@ endif ## # Find Garbage ## -Cruft = CVS RCS SCCS *~ .*~ .nfs\* .*.wmd +Cruft = CVS RCS SCCS *~ .*~ .nfs\* .*.wmd .svn .DS_Store Find_Cruft = '(' $(Cruft:%=-name '%' -or) -name '' ')' -print ## diff --git a/bin/compress-man-pages.pl b/bin/compress-man-pages.pl index 7daea4a..e182d8c 100755 --- a/bin/compress-man-pages.pl +++ b/bin/compress-man-pages.pl @@ -74,21 +74,23 @@ for my $dir (@ARGV) { while(($count = scalar(@compress)) > 0) { $_ = $count > $N ? $N : $count; my @args = splice(@compress, 0, $_); - print "gzip -f @args\n"; - system('gzip', '-f', @args) == 0 or die "gzip failed\n";; + print "gzip -f -n @args\n"; + system('gzip', '-f', '-n', @args) == 0 or die "gzip failed\n";; } foreach my $list (@links) { my $main = shift(@$list); for(@$list) { - printf "rm $_; ln $main.gz $_.gz\n"; + printf "rm $_; ln -f $main.gz $_.gz\n"; unlink $_ or die "Can't unlink: $!\n"; + unlink "$_.gz"; link("$main.gz", "$_.gz") or die "Can't link: $!\n";; } } for(@symlinks) { my $link = readlink($_); - printf "rm $_; ln -s $link.gz $_.gz\n"; + printf "rm $_; ln -fs $link.gz $_.gz\n"; unlink $_ or die "Can't unlink: $!\n"; + unlink "$_.gz"; symlink("$link.gz", "$_.gz") or die "Can't symlink: $!\n"; } }