|
|
1.1 ! root 1: /* ! 2: * This will build an uninstalled program. This can be used ! 3: * for multiple programs in the same Makefile. ! 4: */ ! 5: #define SingleProgramTarget(program,objects,locallibs,syslibs) @@\ ! 6: program: objects locallibs @@\ ! 7: rm -f $@ @@\ ! 8: $(CC) -o $@ objects locallibs $(LDFLAGS) syslibs @@\ ! 9: @@\ ! 10: relink:: @@\ ! 11: rm -f program @@\ ! 12: $(MAKE) $(MFLAGS) program @@\ ! 13: @@\ ! 14: clean:: @@\ ! 15: rm -f program ! 16: ! 17: /* ! 18: * This target can be called by all programs that are contained in ! 19: * a single c source file. ! 20: */ ! 21: #define SimpleProgramTarget(program) @@\ ! 22: OBJS = program.o @@\ ! 23: SRCS = program.c @@\ ! 24: @@\ ! 25: ComplexProgramTarget(program) ! 26: ! 27: ! 28: /* ! 29: * This target is the general interface for building a single program ! 30: */ ! 31: #define ComplexProgramTarget(program) @@\ ! 32: PROGRAM = program @@\ ! 33: @@\ ! 34: all:: program @@\ ! 35: @@\ ! 36: program: $(OBJS) $(LOCAL_LIBRARIES) @@\ ! 37: rm -f $@ @@\ ! 38: $(CC) -o $@ $(OBJS) $(LOCAL_LIBRARIES) $(LDFLAGS) @@\ ! 39: @@\ ! 40: relink: @@\ ! 41: rm -f $(PROGRAM) @@\ ! 42: $(MAKE) $(MFLAGS) $(PROGRAM) @@\ ! 43: @@\ ! 44: InstallProgram(program,$(BINDIR)) @@\ ! 45: InstallManPage(program,$(MANDIR)) @@\ ! 46: DependTarget() @@\ ! 47: clean:: @@\ ! 48: rm -f $(PROGRAM) ! 49: ! 50: /* ! 51: * These targets are the general interface for building multiple programs ! 52: * in a single Makefile. ! 53: */ ! 54: #define ComplexProgramTarget_1(program,locallib,syslib) @@\ ! 55: OBJS = $(OBJS1) $(OBJS2) $(OBJS3) @@\ ! 56: SRCS = $(SRCS1) $(SRCS2) $(SRCS3) @@\ ! 57: @@\ ! 58: all: $(PROGRAMS) @@\ ! 59: @@\ ! 60: program: $(OBJS1) locallib @@\ ! 61: rm -f $@ @@\ ! 62: $(CC) -o $@ $(OBJS1) locallib $(LDFLAGS) syslib @@\ ! 63: @@\ ! 64: InstallProgram(program,$(BINDIR)) @@\ ! 65: InstallManPage(program,$(MANDIR)) @@\ ! 66: relink:: @@\ ! 67: rm -f $(PROGRAMS) @@\ ! 68: $(MAKE) $(MFLAGS) $(PROGRAMS) @@\ ! 69: @@\ ! 70: DependTarget() @@\ ! 71: clean:: @@\ ! 72: rm -f $(PROGRAMS) ! 73: ! 74: #define ComplexProgramTarget_2(program,locallib,syslib) @@\ ! 75: program: $(OBJS2) locallib @@\ ! 76: rm -f $@ @@\ ! 77: $(CC) -o $@ $(OBJS2) locallib $(LDFLAGS) syslib @@\ ! 78: @@\ ! 79: InstallProgram(program,$(BINDIR)) @@\ ! 80: InstallManPage(program,$(MANDIR)) ! 81: ! 82: #define ComplexProgramTarget_3(program,locallib,syslib) @@\ ! 83: program: $(OBJS3) locallib @@\ ! 84: rm -f $@ @@\ ! 85: $(CC) -o $@ $(OBJS3) locallib $(LDFLAGS) syslib @@\ ! 86: @@\ ! 87: InstallProgram(program,$(BINDIR)) @@\ ! 88: InstallManPage(program,$(MANDIR)) ! 89: ! 90: #define ServerTarget(server,subdirs,objects,libs,syslibs) @@\ ! 91: server: subdirs objects libs load/**/server @@\ ! 92: @@\ ! 93: load/**/server: @@\ ! 94: -mv server server.bak @@\ ! 95: $(CC) $(CDEBUGFLAGS) -o server objects libs syslibs ! 96: ! 97: /* ! 98: * Install a Library. ! 99: */ ! 100: #define InstallLibrary(libname,dest) @@\ ! 101: install:: lib/**/libname.a @@\ ! 102: $(INSTALL) $(INSTLIBFLAGS) lib/**/libname.a dest @@\ ! 103: ranlib dest/lib/**/libname.a ! 104: ! 105: /* ! 106: * Install a Library Alias. ! 107: */ ! 108: #define InstallLibraryAlias(libname,alias,dest) @@\ ! 109: install:: @@\ ! 110: rm -f dest/lib/**/alias.a @@\ ! 111: ln dest/lib/**/libname.a dest/lib/**/alias.a ! 112: ! 113: /* ! 114: * Install a Lint Library. ! 115: */ ! 116: #define InstallLintLibrary(libname,dest) @@\ ! 117: install:: llib-l/**/libname.ln @@\ ! 118: $(INSTALL) $(INSTLIBFLAGS) llib-l/**/libname.ln dest ! 119: ! 120: /* ! 121: * Install a man page. ! 122: */ ! 123: #define InstallManPage(file,dest) @@\ ! 124: install:: file.man @@\ ! 125: $(INSTALL) -c -m 0664 file.man dest/file.ManSuffix ! 126: ! 127: /* ! 128: * Install a non-executable file. ! 129: */ ! 130: #define InstallNonExec(file,dest) @@\ ! 131: install:: file @@\ ! 132: $(INSTALL) -c -m 0664 file dest ! 133: ! 134: /* ! 135: * Install a program ! 136: */ ! 137: #define InstallProgram(program,dest) @@\ ! 138: install:: program @@\ ! 139: $(INSTALL) -c $(INSTALLFLAGS) program dest ! 140: ! 141: /* ! 142: * Install a shell script ! 143: */ ! 144: #define InstallScript(program,dest) @@\ ! 145: install:: program.script @@\ ! 146: $(INSTALL) -c $(INSTALLFLAGS) program.script dest/program ! 147: ! 148: /* ! 149: * Install multiple programs ! 150: */ ! 151: #define InstallMultiple(list,dest) @@\ ! 152: install:: list @@\ ! 153: @case '${MFLAGS}' in *[i]*) set +e;; esac; \ @@\ ! 154: for i in list; do \ @@\ ! 155: (set -x; $(INSTALL) -c $(INSTALLFLAGS) $$i dest); \ @@\ ! 156: done ! 157: ! 158: /* ! 159: * This makes the depend target given OBJS. ! 160: */ ! 161: #define DependTarget() @@\ ! 162: depend:: @@\ ! 163: $(DEPEND) -s "# DO NOT DELETE" $(CFLAGS) $(SRCS) ! 164: ! 165: #define CleanTarget() @@\ ! 166: clean:: @@\ ! 167: $(RM_CMD) \#* ! 168: ! 169: #define TagsTarget() @@\ ! 170: tags:: @@\ ! 171: $(TAGS) -w *.[ch] @@\ ! 172: $(TAGS) -xw *.[ch] > TAGS ! 173: ! 174: #define MakefileTarget() @@\ ! 175: Makefile:: Imakefile \ @@\ ! 176: $(UTILSRC)/imake.includes/Imake.tmpl \ @@\ ! 177: $(UTILSRC)/imake.includes/Imake.rules \ @@\ ! 178: $(UTILSRC)/imake.includes/$(MACROFILE) @@\ ! 179: -rm -f Makefile.bak; mv Makefile Makefile.bak @@\ ! 180: $(IMAKE_CMD) -DTOPDIR=$(TOP) ! 181: ! 182: /* ! 183: * for objects in libraries ! 184: */ ! 185: #define NormalLibraryObjectRule() @@\ ! 186: .c.o: @@\ ! 187: $(CC) -c $(CFLAGS) $*.c ! 188: ! 189: #define ProfiledLibraryObjectRule() @@\ ! 190: .c.o: @@\ ! 191: $(CC) -pg -c $(CFLAGS) $*.c @@\ ! 192: mv $*.o profiled/$*.o @@\ ! 193: $(CC) -c $(CFLAGS) $*.c ! 194: ! 195: #define DebuggedLibraryObjectRule() @@\ ! 196: .c.o: @@\ ! 197: $(CC) -g -c $(CFLAGS) $*.c @@\ ! 198: mv $*.o debugger/$*.o @@\ ! 199: $(CC) -c $(CFLAGS) $*.c ! 200: ! 201: #define DebuggedAndProfiledLibraryObjectRule() @@\ ! 202: .c.o: @@\ ! 203: $(CC) -pg -c $(CFLAGS) $*.c @@\ ! 204: mv $*.o profiled/$*.o @@\ ! 205: $(CC) -g -c $(CFLAGS) $*.c @@\ ! 206: mv $*.o debugger/$*.o @@\ ! 207: $(CC) -c $(CFLAGS) $*.c ! 208: ! 209: #define NormalLibraryTarget(libname,objlist) @@\ ! 210: all:: lib/**/libname.a @@\ ! 211: @@\ ! 212: lib/**/libname.a: objlist @@\ ! 213: rm -f $@ @@\ ! 214: ar clq $@ objlist @@\ ! 215: ranlib $@ ! 216: ! 217: #define ProfiledLibraryTarget(libname,objlist) @@\ ! 218: all:: lib/**/libname/**/_p.a @@\ ! 219: @@\ ! 220: lib/**/libname/**/_p.a: objlist @@\ ! 221: rm -f $@ @@\ ! 222: cd profiled; ar clq ../$@ objlist @@\ ! 223: ranlib $@ @@\ ! 224: @@\ ! 225: clean:: @@\ ! 226: rm -f profiled/?*.o ! 227: ! 228: #define DebuggedLibraryTarget(libname,objlist) @@\ ! 229: all:: lib/**/libname/**/_d.a @@\ ! 230: @@\ ! 231: lib/**/libname/**/_d.a: objlist @@\ ! 232: rm -f $@ @@\ ! 233: cd debugger; ar clq ../$@ objlist @@\ ! 234: ranlib $@ @@\ ! 235: @@\ ! 236: clean:: @@\ ! 237: rm -f debugger/?*.o ! 238: ! 239: #define AliasedLibraryTarget(libname,alias) @@\ ! 240: all:: lib/**/alias.a @@\ ! 241: lib/**/alias.a: lib/**/libname.a @@\ ! 242: rm -f $@ @@\ ! 243: ln -s lib/**/libname.a $@ ! 244: ! 245: /* ! 246: * Note that we force the lint library to always be newer than the ! 247: * library itself. ! 248: */ ! 249: #define LintLibraryTarget(libname,srclist) @@\ ! 250: lintlib:: llib-l/**/libname.ln @@\ ! 251: @@\ ! 252: llib-l/**/libname.ln: srclist @@\ ! 253: rm -f $@ @@\ ! 254: $(LINT) -C/**/libname $(DEFINES) ${INCLUDES} srclist ! 255: ! 256: /* ! 257: * if you want CDEBUGFLAGS passed along to subdirectories, then ! 258: * provide a line like this in the appropriate Imakefile ! 259: * #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' ! 260: */ ! 261: #define MakeSubdirs(dirs) @@\ ! 262: NamedMakeSubdirs(all,dirs) ! 263: ! 264: #define NamedMakeSubdirs(name,dirs) @@\ ! 265: name:: @@\ ! 266: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 267: for i in dirs ;\ @@\ ! 268: do \ @@\ ! 269: (cd $$i ; echo "making $$i"; \ @@\ ! 270: $(MAKE) PassCDebugFlags $(MFLAGS)); \ @@\ ! 271: done ! 272: ! 273: #define DependSubdirs(dirs) @@\ ! 274: NamedDependSubdirs(depend,dirs) ! 275: ! 276: #define NamedDependSubdirs(name,dirs) @@\ ! 277: name:: @@\ ! 278: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 279: for i in dirs ;\ @@\ ! 280: do \ @@\ ! 281: (cd $$i ; echo "depending $$i"; \ @@\ ! 282: $(MAKE) $(MFLAGS) depend ); \ @@\ ! 283: done ! 284: ! 285: #define InstallSubdirs(dirs) @@\ ! 286: install:: @@\ ! 287: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 288: for i in dirs ;\ @@\ ! 289: do \ @@\ ! 290: (cd $$i ; echo "installing $$i"; \ @@\ ! 291: $(MAKE) $(MFLAGS) \ @@\ ! 292: INSTALL='$(INSTALL)' \ @@\ ! 293: DESTDIR='$(DESTDIR)' install ); \ @@\ ! 294: done ! 295: ! 296: #define CleanSubdirs(dirs) @@\ ! 297: clean:: @@\ ! 298: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 299: for i in dirs ;\ @@\ ! 300: do \ @@\ ! 301: (cd $$i ; echo "cleaning $$i"; \ @@\ ! 302: $(MAKE) $(MFLAGS) RM_CMD='$(RM_CMD)' clean ); \ @@\ ! 303: done ! 304: ! 305: #define TagSubdirs(dirs) @@\ ! 306: tags:: @@\ ! 307: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 308: for i in dirs ;\ @@\ ! 309: do \ @@\ ! 310: (cd $$i ; echo "tagging $$i"; \ @@\ ! 311: $(MAKE) $(MFLAGS) TAGS='$(TAGS)' tags ); \ @@\ ! 312: done ! 313: ! 314: #define LintSubdirs(dirs) @@\ ! 315: lint:: @@\ ! 316: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 317: for i in dirs ;\ @@\ ! 318: do \ @@\ ! 319: (cd $$i ; echo "linting $$i"; \ @@\ ! 320: $(MAKE) $(MFLAGS) LINT='$(LINT)' lint ); \ @@\ ! 321: done ! 322: ! 323: #define MakeLintLibSubdirs(dirs) @@\ ! 324: lintlib:: @@\ ! 325: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 326: for i in dirs ;\ @@\ ! 327: do \ @@\ ! 328: (cd $$i ; echo "making lintlib in $$i"; \ @@\ ! 329: $(MAKE) $(MFLAGS) LINT='$(LINT)' lintlib ); \ @@\ ! 330: done ! 331: ! 332: #define MakefileSubdirs(dirs) @@\ ! 333: Makefiles:: @@\ ! 334: @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ @@\ ! 335: for i in dirs ;\ @@\ ! 336: do \ @@\ ! 337: echo "Making Makefiles in $$i..."; \ @@\ ! 338: case "$$i" in \ @@\ ! 339: ./?*/?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ ! 340: ./?*/?*) newtop=../../ sub=subsub;; \ @@\ ! 341: ./?*) newtop=../ sub=sub;; \ @@\ ! 342: */?*/?*) newtop=../../../ sub=subsubsub;; \ @@\ ! 343: */?*) newtop=../../ sub=subsub;; \ @@\ ! 344: *) newtop=../ sub=sub;; \ @@\ ! 345: esac; \ @@\ ! 346: $(MAKE) $${sub}dirMakefiles NEWTOP=$$newtop \ @@\ ! 347: MAKEFILE_SUBDIR=$$i;\ @@\ ! 348: done @@\ ! 349: @@\ ! 350: subdirMakefiles: @@\ ! 351: rm -f $(MAKEFILE_SUBDIR)/Makefile.bak @@\ ! 352: -mv $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak @@\ ! 353: cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(TOP)/..; \ @@\ ! 354: $(MAKE) $(MFLAGS) Makefiles @@\ ! 355: @@\ ! 356: subsubdirMakefiles: @@\ ! 357: rm -f $(MAKEFILE_SUBDIR)/Makefile.bak @@\ ! 358: -mv $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak @@\ ! 359: cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(TOP)/../..; \ @@\ ! 360: $(MAKE) $(MFLAGS) Makefiles @@\ ! 361: @@\ ! 362: subsubsubdirMakefiles: @@\ ! 363: rm -f $(MAKEFILE_SUBDIR)/Makefile.bak @@\ ! 364: -mv $(MAKEFILE_SUBDIR)/Makefile $(MAKEFILE_SUBDIR)/Makefile.bak @@\ ! 365: cd $(MAKEFILE_SUBDIR); $(IMAKE_CMD) -DTOPDIR=$(TOP)/../../..; \ @@\ ! 366: $(MAKE) $(MFLAGS) Makefiles @@\ ! 367:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.