|
|
1.1 ! root 1: ## ! 2: # Copyright (c) 1999 Apple Computer, Inc. All rights reserved. ! 3: # ! 4: # @APPLE_LICENSE_HEADER_START@ ! 5: # ! 6: # Portions Copyright (c) 1999 Apple Computer, Inc. All Rights ! 7: # Reserved. This file contains Original Code and/or Modifications of ! 8: # Original Code as defined in and that are subject to the Apple Public ! 9: # Source License Version 1.1 (the "License"). You may not use this file ! 10: # except in compliance with the License. Please obtain a copy of the ! 11: # License at http://www.apple.com/publicsource and read it before using ! 12: # this file. ! 13: # ! 14: # The Original Code and all software distributed under the License are ! 15: # distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER ! 16: # EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, ! 17: # INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, ! 18: # FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the ! 19: # License for the specific language governing rights and limitations ! 20: # under the License. ! 21: # ! 22: # @APPLE_LICENSE_HEADER_END@ ! 23: ## ! 24: ! 25: # ! 26: # Makefile include file for simple commands ! 27: # Copyright NeXT, Inc. 1992. All rights reserved. ! 28: # ! 29: ! 30: # ! 31: # TOOLS ! 32: # ! 33: MD= md ! 34: ifneq "" "$(wildcard /bin/mkdirs)" ! 35: MKDIRS = /bin/mkdirs ! 36: else ! 37: MKDIRS = /bin/mkdir -p ! 38: endif ! 39: ! 40: ! 41: # ! 42: # Default type(s) to build ! 43: # ! 44: TYPES= STD ! 45: ! 46: # ! 47: # Sources for tags ! 48: # ! 49: SRCS= $(HFILES) $(YFILES) $(CFILES) $(SFILES) $(EXTRA_SRCS) ! 50: ! 51: # ! 52: # Build list of object modules from source files ! 53: # Trick is to strip off any path prefix ! 54: # ! 55: XCOBJS= $(CFILES:.c=.o) ! 56: COBJS= $(XCOBJS:t) ! 57: ! 58: XYOBJS= $(YFILES:.y=.o) ! 59: YOBJS= $(XYOBJS:t) ! 60: ! 61: XLOBJS= $(LFILES:.l=.o) ! 62: LOBJS= $(XLOBJS:t) ! 63: ! 64: XSOBJS= $(SFILES:.s=.o) ! 65: SOBJS= $(XSOBJS:t) ! 66: ! 67: # ! 68: # Make the first SOBJ be the first module loaded. Simplifies ! 69: # getting crt0.s in the right place for programs that need it first. ! 70: # ! 71: OBJS= $(SOBJS) $(YOBJS) $(LOBJS) $(COBJS) $(EXTRA_OBJS) ! 72: ! 73: # ! 74: # This makefile actually does builds in $(OBJROOT). Set-up vpath so ! 75: # sources may be found. ! 76: # ! 77: STD_VPATH=$(SRCDIR) ! 78: PROF_VPATH=$(SRCDIR) ! 79: DBG_VPATH=$(SRCDIR) ! 80: ! 81: # ! 82: # Options that we want to force. These are applied to all makes ! 83: # of the appropriate type ! 84: # ! 85: STD_CFORCE= ! 86: PROF_CFORCE= ! 87: DBG_CFORCE= ! 88: ! 89: STD_LDFORCE= ! 90: PROF_LDFORCE= ! 91: DBG_LDFORCE= ! 92: ! 93: # ! 94: # *_NAME's are used by vers_string so that it's apparent which ! 95: # binary type you have (debug, prof, etc) by looking at the vers_string ! 96: # ! 97: STD_NAME= ! 98: PROF_NAME=_PROF ! 99: DBG_NAME=_DBG ! 100: ! 101: # ! 102: # These commands are executed whenever make exits, they clean-up ! 103: # any crud left about. ! 104: # ! 105: STD_EXIT= $(RM) $(RMFLAGS) $(DERIVED) *.d ! 106: PROF_EXIT= $(RM) $(RMFLAGS) $(DERIVED) *.d ! 107: DBG_EXIT= $(RM) $(RMFLAGS) $(DERIVED) *.d ! 108: ! 109: # ! 110: # We have to tell the compiler what type of code to generate ! 111: # ! 112: ! 113: CODE_GEN_STYLE = STATIC ! 114: # ! 115: # Indirection used to get appropriate options for the TYPE of build ! 116: # being done. ! 117: # ! 118: ! 119: STATIC_COPTS = -static ! 120: STATIC_LDOPTS = ${STATIC_COPTS} ! 121: ! 122: DYNAMIC_COPTS = -dynamic -fno-common ! 123: DYNAMIC_LDOPTS = ${DYNAMIC_COPTS} ! 124: ! 125: COPTS= ${$(TYPE)_CFORCE} ${$(TYPE)_COPTS} ${${CODE_GEN_STYLE}_COPTS} ! 126: LDOPTS= ${$(TYPE)_LDFORCE} ${$(TYPE)_LDOPTS} ${${CODE_GEN_STYLE}_LDOPTS} ! 127: XLIBS= ${$(TYPE)_LIBS} ! 128: ! 129: NAME=${$(TYPE)_NAME} ! 130: VPATH=${$(TYPE)_VPATH} ! 131: EXIT=${$(TYPE)_EXIT} ! 132: ! 133: # ! 134: # This is completely untested! ! 135: # ! 136: CMD_FLAGS= "RC_FLAGS=$(RC_FLAGS)" "RC_ARCH=$(RC_ARCH)" ! 137: ! 138: # ! 139: # Cause .c file to be built from yacc file ! 140: # ! 141: XYFILES= $(YFILES:t) ! 142: $(XYFILES:.y=.c): $$(@:.c=.y) ! 143: ! 144: # ! 145: # Indicate that y.tab.h depends on yacc source ! 146: # ! 147: y.tab.h: $(YFILES) ! 148: ! 149: # ! 150: # Cause .c file to be built from lex file ! 151: # ! 152: XLFILES= $(LFILES:t) ! 153: $(XLFILES:.l=.c): $$(@:.c=.l) ! 154: ! 155: # ! 156: # CCFLAGS are for command line use ! 157: # e.g. make CCFLAGS="-I/foo/bar/include" ! 158: # ! 159: # RC_CFLAGS are for Release Control use. ! 160: # ! 161: .c.o: ! 162: $(CC) -MD $(CFLAGS) $(COPTS) $(RC_CFLAGS) $(CCFLAGS) -c -o $@ $< ! 163: $(MD) -d -u Makedep $*.d ! 164: ! 165: .s.o: ! 166: $(CC) -MD $(SFLAGS) $(CFLAGS) $(COPTS) $(RC_CFLAGS) $(CCFLAGS) \ ! 167: -c -o $@ $< ! 168: $(MD) -d -u Makedep $*.d ! 169: ! 170: # ! 171: # Standard clean-up on exit ! 172: # ! 173: .EXIT: ! 174: -$(EXIT) ! 175: ! 176: # ! 177: # Standard targets ! 178: # All executed in "source" directory ! 179: # ! 180: .DEFTARGET: all ! 181: ! 182: all: $(TYPES) ! 183: ! 184: remake: clean all ! 185: ! 186: # ! 187: # Initial rule for handling: ! 188: # STD (release) ! 189: # PROF (profiling) ! 190: # DBG (debugging) ! 191: # builds. ! 192: # ! 193: # "make DBG" builds a debugging version. Objects are placed ! 194: # DBG_OBJS. ! 195: # ! 196: # Main trick here is to convert (possibly relative) pathnames to ! 197: # absolute paths via pwd. Then reinvoke make with appropriate ! 198: # macros defined. ! 199: # ! 200: STD PROF DBG: $(SYMROOT)/$(PROGRAM)_$$@_OBJS \ ! 201: $(OBJROOT)/$(PROGRAM)_$$@_OBJS ALWAYS ! 202: @echo cd $(OBJROOT)/$(PROGRAM)_$@_OBJS ! 203: @SRCDIR=`pwd`; \ ! 204: cd $(SYMROOT); SYMDIR=`pwd`; cd $$SRCDIR; \ ! 205: SRCDIR=`relpath -d $(VERSDIR) $(OBJROOT)/$(PROGRAM)_$@_OBJS $$SRCDIR`;\ ! 206: SYMDIR=`relpath -d $(VERSDIR) $(OBJROOT)/$(PROGRAM)_$@_OBJS $$SYMDIR`;\ ! 207: cd $(OBJROOT)/$(PROGRAM)_$@_OBJS; \ ! 208: $(MAKE) -f $$SRCDIR/Makefile TYPE="$@" \ ! 209: SRCDIR=$$SRCDIR SYMROOT=$$SYMDIR OBJROOT=.. $(CMD_FLAGS) \ ! 210: $$SYMDIR/$(PROGRAM)_$@_OBJS/$(PROGRAM) ! 211: ! 212: install: DSTROOT $(DSTDIRS) STD install_extra installhdrs ALWAYS ! 213: install $(IFLAGS) \ ! 214: $(SYMROOT)/$(PROGRAM)_STD_OBJS/$(PROGRAM) \ ! 215: $(DSTROOT)$(BINDIR)/$(PROGRAM) ! 216: ! 217: reinstall: clean install ! 218: ! 219: clean: ALWAYS ! 220: -$(RM) -rf $(OBJROOT)/$(PROGRAM)_*_OBJS ! 221: @-if [ $(SYMROOT) != $(OBJROOT) ]; \ ! 222: then \ ! 223: echo $(RM) -rf $(SYMROOT)/$(PROGRAM)_*_OBJS; \ ! 224: $(RM) -rf $(SYMROOT)/$(PROGRAM)_*_OBJS; \ ! 225: fi ! 226: ! 227: clobber: clean ! 228: -$(RM) $(RMFLAGS) $(GARBAGE) ! 229: ! 230: tags: ALWAYS tags_link ! 231: $(RM) -f TAGS tags ! 232: etags -et $(SRCS) ! 233: ctags -w $(SRCS) ! 234: ! 235: # ! 236: # Internal targets ! 237: # All targets below are executed in "source" directory ! 238: # ! 239: ! 240: DSTROOT OBJROOT: ALWAYS ! 241: @if [ -n "$($@)" ]; \ ! 242: then \ ! 243: exit 0; \ ! 244: else \ ! 245: echo Must define $@; \ ! 246: exit 1; \ ! 247: fi ! 248: ! 249: $(DSTDIRS): ! 250: $(MKDIRS) $@ ! 251: ! 252: $(OBJROOT)/$(PROGRAM)_DBG_OBJS \ ! 253: $(OBJROOT)/$(PROGRAM)_PROF_OBJS \ ! 254: $(OBJROOT)/$(PROGRAM)_STD_OBJS \ ! 255: $(SYMROOT)/$(PROGRAM)_DBG_OBJS \ ! 256: $(SYMROOT)/$(PROGRAM)_PROF_OBJS \ ! 257: $(SYMROOT)/$(PROGRAM)_STD_OBJS: ! 258: $(MKDIRS) $@ ! 259: ! 260: # ! 261: # "Internal" target to building the command ! 262: # Executed in $(OBJROOT)/$(PROGRAM)_$(TYPE)_OBJS ! 263: # ! 264: # This makefile when invoked in the OBJROOT will have the following ! 265: # macros defined: ! 266: # SRCDIR -- path to the directory containing this Makefile ! 267: # SYMROOT -- path to the directory that is to contain the result ! 268: # of this build ! 269: # ! 270: $(SYMROOT)/$(PROGRAM)_$(TYPE)_OBJS/$(PROGRAM): \ ! 271: $(OBJS) vers.o $(SRCDIR)/Makefile ! 272: $(CC) $(LDFLAGS) $(LDOPTS) $(RC_CFLAGS) \ ! 273: -o $@ $(OBJS) vers.o $(XLIBS) $(LIBS) ! 274: ! 275: vers.c: $(OBJS) ! 276: @$(RM) -f $@ ! 277: vers_string -c $(PROGRAM)$(NAME) > $@ ! 278: ! 279: ALWAYS: ! 280: ! 281: # ! 282: # This must be designed to work in the context of ! 283: # $(OBJROOT)/$(PROGRAM)_$(TYPE)_OBJS. Since include ! 284: # files are found relative to the Makefile, this should ! 285: # do the trick. ! 286: # ! 287: -include $(OBJROOT)/$(PROGRAM)_$(TYPE)_OBJS/Makedep
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.