|
|
1.1 ! root 1: # Makefile for OSKit-Mach microkernel ! 2: # Copyright 1997, 1999 Free Software Foundation, Inc. ! 3: # ! 4: # Permission to use, copy, modify and distribute this software and its ! 5: # documentation is hereby granted, provided that both the copyright ! 6: # notice and this permission notice appear in all copies of the ! 7: # software, derivative works or modified versions, and any portions ! 8: # thereof, and that both notices appear in supporting documentation. ! 9: # ! 10: # THE FREE SOFTWARE FOUNDATION ALLOWS FREE USE OF THIS SOFTWARE IN ITS ! 11: # "AS IS" CONDITION. THE FREE SOFTWARE FOUNDATION DISCLAIMS ANY ! 12: # LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE ! 13: # USE OF THIS SOFTWARE. ! 14: ! 15: ! 16: ! 17: ! 18: # Variables from `configure'. ! 19: srcdir=@srcdir@ ! 20: systype=@systype@ ! 21: prefix=@prefix@ ! 22: version = @PACKAGE_VERSION@ ! 23: force_install=@force_install@ ! 24: ! 25: exec_prefix=$(prefix) ! 26: ! 27: bootdir=$(exec_prefix)/boot ! 28: includedir=$(prefix)/include ! 29: libexecdir=$(exec_prefix)/libexec ! 30: bindir=$(exec_prefix)/bin ! 31: ! 32: installed-kernel = $(bootdir)/oskit-mach ! 33: ! 34: sysdep = $(srcdir)/$(systype) ! 35: ! 36: # Programs found by configure. ! 37: AWK = @AWK@ ! 38: INSTALL = @INSTALL@ ! 39: CC = @CC@ ! 40: LD = @LD@ ! 41: NM = @NM@ ! 42: MIG = @MIG@ ! 43: MBCHK = @MBCHK@ ! 44: ! 45: INSTALL_PROGRAM = @INSTALL_PROGRAM@ ! 46: INSTALL_DATA = @INSTALL_DATA@ ! 47: ! 48: CFLAGS = @CFLAGS@ ! 49: LDFLAGS = @LDFLAGS@ ! 50: SMP_LIBS = @SMP_LIBS@ ! 51: ! 52: all: ! 53: ! 54: # All the possible architectures ! 55: all-archs = i386 ! 56: ! 57: all-archs-subdirs = $(patsubst %,$(srcdir)/%/Subdirs,$(all-archs)) ! 58: all-archs-files = $(patsubst %,$(srcdir)/%/Files,$(all-archs)) ! 59: all-archs-configures = $(patsubst %,$(srcdir)/%/configure,$(all-archs)) ! 60: ! 61: # Files distributed from the top level directory: ! 62: topfiles = ChangeLog ChangeLog.0 ChangeLog.00 Drivers.macros Makefile.in \ ! 63: README INSTALL config.guess config.sub configure configure.in \ ! 64: gensym.awk install-sh version.c.in NEWS aclocal.m4 COPYING ! 65: ! 66: # All the source in each directory. ! 67: ! 68: # Old crud from a previous configure scheme ! 69: bogus-files = bootstrap_symbols.h fast_tas.h hw_footprint.h net_atm.h \ ! 70: power_save.h simple_clock.h stat_time.h \ ! 71: $(patsubst %,mach_%.h,assert counters debug fixpri host ipc_compat \ ! 72: ipc_debug ipc_test kdb ldebug lock_mon machine_routines mp_debug \ ! 73: pagemap pcsample ttd vm_debug) \ ! 74: $(patsubst %,norma_%.h,device ether ipc task vm) ! 75: ! 76: # Device support interfaces ! 77: device-files = \ ! 78: device_init.c dev_pager.c \ ! 79: net_io.c \ ! 80: dev_hdr.h dev_master.h device_port.h \ ! 81: device_types_kernel.h ds_routines.h \ ! 82: memory_object_reply.cli \ ! 83: device_pager.srv device.srv \ ! 84: device_reply.cli device_error_reply.cli ! 85: device-cfiles = $(filter %.c,$(device-files)) ! 86: ! 87: # IPC implementation ! 88: ipc-cfiles = $(addprefix ipc_,$(ipc-names)) \ ! 89: mach_msg.c mach_port.c mach_rpc.c mach_debug.c fipc.c ! 90: ipc-names = entry.c hash.c init.c kmsg.c marequest.c mqueue.c \ ! 91: notify.c object.c port.c pset.c right.c space.c splay.c \ ! 92: table.c target.c thread.c ! 93: ipc-files = $(ipc-cfiles) mach_port.srv fipc.h port.h mach_msg.h \ ! 94: $(patsubst %,ipc_%.h, \ ! 95: entry hash init kmsg kmsg_queue machdep marequest mqueue notify \ ! 96: object port pset right space splay table target thread types) ! 97: ! 98: # "kernel" implementation (tasks, threads, trivia, etc.) ! 99: kern-cfiles = act.c ast.c bootstrap.c counters.c eventcount.c \ ! 100: exception.c host.c ipc_host.c ipc_kobject.c ipc_mig.c ipc_sched.c \ ! 101: ipc_tt.c kalloc.c lock.c lock_mon.c mach_clock.c mach_factor.c \ ! 102: machine.c pc_sample.c priority.c processor.c profile.c \ ! 103: queue.c sched_prim.c startup.c syscall_emulation.c \ ! 104: syscall_subr.c syscall_sw.c task.c thread.c thread_swap.c \ ! 105: time_stamp.c timer.c zalloc.c boot_script.c ! 106: kern-files = $(kern-cfiles) \ ! 107: act.h assert.h ast.h compat_xxx_defs.h counters.h cpu_number.h \ ! 108: debug.h eventcount.h host.h ipc_host.h ipc_kobject.h ipc_sched.h \ ! 109: ipc_tt.h kalloc.h kern_types.h lock.h mach_param.h macro_help.h \ ! 110: pc_sample.h processor.h queue.h refcount.h sched.h sched_prim.h \ ! 111: shuttle.h syscall_emulation.h syscall_subr.h syscall_sw.h \ ! 112: task.h thread.h thread_swap.h time_out.h time_stamp.h timer.h \ ! 113: zalloc.h boot_script.h \ ! 114: mach.srv mach4.srv mach_debug.srv mach_host.srv ! 115: ! 116: # Virtual memory implementation ! 117: vm-cfiles = $(addprefix vm_,$(vm-names)) memory_object.c ! 118: vm-names = debug.c external.c fault.c init.c kern.c map.c \ ! 119: object.c pageout.c resident.c user.c ! 120: vm-files = $(vm-cfiles) memory_object_default.cli memory_object_user.cli \ ! 121: memory_object.h pmap.h $(patsubst %,vm_%.h, \ ! 122: external fault kern map object page pageout user) ! 123: ! 124: # OSKit support files ! 125: osenv-overrides = osenv_mem \ ! 126: osenv_log \ ! 127: osenv_irq \ ! 128: osenv_sleep osenv_synch osenv_timer \ ! 129: osenv_bell osenv_softirq ! 130: oskit-cfiles = $(osenv-overrides:=.c) \ ! 131: main.c ds_osenv.c ds_request.c ds_routines.c kmsg.c \ ! 132: ds_block.c ds_partition.c \ ! 133: ds_mem.c ds_bus.c \ ! 134: ds_net.c \ ! 135: ds_stream.c \ ! 136: ds_asyncio.c smp-glue.c ! 137: oskit-files = $(oskit-cfiles) ds_oskit.h ! 138: ! 139: oskit-dirs-alpha := alpha pc ! 140: oskit-dirs-i386 := x86 pc ! 141: ! 142: ! 143: # Documentation ! 144: doc-files = Makefile.in fdl.texi gpl.texi mach.texi ! 145: ! 146: # Debian packaging ! 147: debian-files = changelog control copyright README.Debian rules postinst prerm ! 148: ! 149: # Object files that go into the kernel image. (This will be augmented by the ! 150: # machine dependent Makefile fragment.) ! 151: ! 152: # Basic kernel source for Mach ! 153: objfiles := $(patsubst %.c,%.o,$(ipc-cfiles) $(kern-cfiles) $(vm-cfiles) \ ! 154: $(device-cfiles) $(oskit-cfiles)) ! 155: vpath %.c $(addprefix $(srcdir)/,ipc kern vm device oskit \ ! 156: $(addprefix oskit/,$(oskit-dirs-$(systype)))) ! 157: ! 158: # Version number ! 159: objfiles += version.o ! 160: ! 161: ! 162: # Header files installed for user use ! 163: device-headers= $(addprefix device/,audio_status.h bpf.h device.defs \ ! 164: device_reply.defs device_request.defs device_types.defs \ ! 165: device_types.h disk_status.h net_status.h tape_status.h \ ! 166: tty_status.h) ! 167: mach-headers= $(addprefix mach/, bootstrap.defs default_pager.defs \ ! 168: default_pager_helper.defs default_pager_types.defs \ ! 169: exc.defs mach.defs mach4.defs mach_host.defs mach_norma.defs \ ! 170: mach_port.defs mach_types.defs memory_object.defs \ ! 171: memory_object_default.defs norma_task.defs notify.defs \ ! 172: std_types.defs \ ! 173: alert.h boolean.h default_pager_types.h exception.h \ ! 174: host_info.h kern_return.h mach_param.h mach_types.h \ ! 175: machine.h macro_help.h memory_object.h message.h mig_errors.h \ ! 176: msg_type.h norma_special_ports.h notify.h \ ! 177: pc_sample.h policy.h port.h processor_info.h \ ! 178: profil.h profilparam.h rpc.h std_types.h syscall_sw.h \ ! 179: task_info.h task_special_ports.h thread_info.h \ ! 180: thread_special_ports.h thread_status.h thread_switch.h \ ! 181: time_value.h version.h vm_attributes.h vm_inherit.h \ ! 182: vm_param.h vm_prot.h vm_statistics.h inline.h) ! 183: mach-debug-headers:= $(addprefix mach_debug/, hash_info.h ipc_info.h \ ! 184: mach_debug.defs mach_debug_types.defs mach_debug_types.h \ ! 185: pc_info.h vm_info.h zone_info.h) ! 186: ! 187: installed-headers:= $(device-headers) $(mach-headers) ! 188: ! 189: # Other headers for the distribution. We don't install these, because the ! 190: # GNU C library has correct versions for users to use. ! 191: other-sys-headers := types.h time.h reboot.h ioctl.h ! 192: other-mach-headers := mig_support.h mach_traps.h error.h ! 193: other-headers := alloca.h ! 194: ! 195: ! 196: # Automatically generated source ! 197: ! 198: # User stubs ! 199: objfiles += memory_object_user_user.o memory_object_default_user.o \ ! 200: memory_object_reply_user.o \ ! 201: device_reply_user.o device_error_reply_user.o ! 202: ! 203: # Server stubs ! 204: objfiles += device_server.o device_pager_server.o mach_port_server.o \ ! 205: mach_server.o mach4_server.o mach_debug_server.o mach_host_server.o ! 206: ! 207: # Where to find the relevant Mig source files ! 208: vpath %.cli $(srcdir)/vm $(srcdir)/device ! 209: vpath %.srv $(srcdir)/device $(srcdir)/ipc $(srcdir)/kern ! 210: ! 211: ! 212: # We need this symlink in place before we start compiling, ! 213: # so <mach/machine/foo.h> headers can be found. ! 214: before-compile = mach/machine ! 215: mach/machine: mach_machine ! 216: test -d $(@D) || mkdir $(@D) ! 217: rm -f $@ ! 218: ln -s ../mach_machine mach/machine ! 219: mach_machine: ! 220: rm -f $@ ! 221: ln -s $(srcdir)/$(systype)/include/mach/$(systype) mach_machine ! 222: ! 223: ! 224: ! 225: # ! 226: # Compilation flags ! 227: # ! 228: ! 229: DEFINES += -DOSKIT_MACH=1 -DMACH -DMACH_KERNEL -DKERNEL -DCONTINUATIONS @DEFS@ ! 230: INCLUDES += -I. -I$(srcdir) -I$(srcdir)/include \ ! 231: -I$(srcdir)/bogus -I$(srcdir)/kern -I$(srcdir)/device ! 232: ! 233: include $(sysdep)/Makefrag ! 234: ! 235: CPPFLAGS += $(DEFINES) $(INCLUDES) ! 236: ! 237: MIGFLAGS += $(CPPFLAGS) ! 238: ! 239: ! 240: # Standard targets ! 241: ! 242: all: kernel ! 243: ! 244: clean: ! 245: rm -f *.[oda] kernel ! 246: rm -f *.symc *.symc.o *_user.c *_server.c ! 247: rm -f $(filter-out config.h,$(wildcard *.h)) ! 248: rm -f *.migs_d *.migsh_d *.migu_d *.miguh_d ! 249: ! 250: distclean: clean ! 251: rm -f config.status config.cache config.log config.h Makefile ! 252: ! 253: mostlyclean: distclean ! 254: ! 255: maintainer-clean: mostlyclean ! 256: rm -f $(srcdir)/configure $(all-archs-configures) ! 257: ! 258: check: kernel ! 259: $(MBCHK) $< ! 260: ! 261: # ! 262: # Kernel Image ! 263: # ! 264: ! 265: # This is the list of routines we decide is OK to steal from the C library. ! 266: clib-routines := memcpy memmove memset bcopy bzero memchr rawmemchr \ ! 267: strstr strtok strchr strchrnul strcpy stpcpy strcat \ ! 268: strcmp strncmp \ ! 269: htonl htons ntohl ntohs ffs ! 270: magic-symbols := etext edata end ! 271: ! 272: ! 273: OSKIT_LIBDIR = @OSKIT_LIBDIR@ ! 274: OSKIT_LIBS = -loskit_kern -loskit_lmm -loskit_com @SMP_LIBS@ \ ! 275: -loskit_exec -loskit_unsupp \ ! 276: -loskit_dev -loskit_linux_dev -loskit_diskpart \ ! 277: ! 278: # These rules are useful for development, but have significant overhead. ! 279: kernel.a: $(objfiles) ! 280: @rm -f $@ ! 281: $(AR) cq $@ $^ ! 282: kernel_nm: kernel.a ; $(NM) -g $< > $@ ! 283: kernel.a.list: kernel.a; $(AR) t $< | sort > $@ ! 284: kernel.map.list: kernel.map ! 285: sed -n 's/^kernel\.a(\([^)]*\)).*$$/\1/p' $< | sort > $@ ! 286: kernel-unused: kernel.a.list kernel.map.list ! 287: (diff -u0 $^ || test $$? -eq 1) | sed -n '1,/@@/d;s/^-//p' > $@ ! 288: k%nel.o k%nel.map: $(OSKIT_LIBDIR)/multiboot.o $(osenv-overrides:=.o) k%nel.a ! 289: $(CC) $(CFLAGS) -nostdlib -nostartfiles $(LDFLAGS) -r \ ! 290: -o $(@:.map=.o) -Wl,-Map=$(@:.o=.map) \ ! 291: -Wl,-\( $^ -L$(OSKIT_LIBDIR)/.. $(OSKIT_LIBS) -Wl,-\) -lgcc ! 292: # This rule has less overhead, but doesn't produce the intermediate ! 293: # results necessary to compute `kernel-unused'. ! 294: kernel.o: $(OSKIT_LIBDIR)/multiboot.o $(objfiles) ! 295: $(CC) $(CFLAGS) -nostdlib -nostartfiles $(LDFLAGS) -r -o $@ \ ! 296: -Wl,-\( $^ -L$(OSKIT_LIBDIR)/.. $(OSKIT_LIBS) -Wl,-\) -lgcc ! 297: ! 298: %-undef: %.o ! 299: $(NM) -u $< | sed 's/ *U *//;s/^_*//' | sort -u > $@ ! 300: ! 301: kernel-clib: kernel-undef Makefile ! 302: sed -n '$(foreach r,$(clib-routines),/^$r$$/p;)' $< > $@ ! 303: clib-routines.o: kernel-clib ! 304: $(CC) $(CFLAGS) -nostdlib -nostartfiles $(LDFLAGS) -r -static \ ! 305: -o $@ \ ! 306: `sed 's/^/-Wl,-u,/' $<` -x c /dev/null -x none -lc ! 307: ! 308: oskit-kern%.o: kern%.o clib-routines.o ! 309: $(CC) $(CFLAGS) -nostdlib -nostartfiles $(LDFLAGS) -r -o $@ \ ! 310: -Wl,-\( $^ -L$(OSKIT_LIBDIR)/.. \ ! 311: -loskit_clientos -loskit_c $(OSKIT_LIBS) -Wl,-\) -lgcc ! 312: ! 313: %-undef-bad: %-undef Makefile ! 314: sed '$(foreach r,$(clib-routines) $(magic-symbols),/^$r$$/d;)' $< > $@ ! 315: ! 316: kern%: oskit-kern%.o $(OSKIT_LIBDIR)/crtn.o ! 317: $(LD) $(LDFLAGS) $(KERN_LDFLAGS) -o $@ $^ ! 318: ! 319: # This combined with the other pattern rules let you ask ! 320: # for a target like `kernel-ide+scsi_ncr53c8xx+ethernet_eepro100' ! 321: # to link a kernel with a given subset of the oskit drivers. ! 322: init-%.c: ! 323: { echo 'void oskit_linux_init_devs(void) {'; \ ! 324: for drv in $(subst +, ,$*); do \ ! 325: echo " oskit_linux_init_$${drv} ();"; \ ! 326: done; echo '}'; \ ! 327: } > $@T ! 328: mv -f $@T $@ ! 329: ! 330: kernel-%.o: $(OSKIT_LIBDIR)/multiboot.o $(objfiles) init-%.o ! 331: $(CC) $(CFLAGS) -nostdlib -nostartfiles $(LDFLAGS) -r -o $@ \ ! 332: -Wl,-\( $^ -L$(OSKIT_LIBDIR)/.. $(OSKIT_LIBS) -Wl,-\) -lgcc ! 333: ! 334: .PHONY: objs ! 335: objs: $(objfiles) ! 336: ! 337: # ! 338: # Installation ! 339: # ! 340: installed-headers-names = $(addprefix $(includedir)/,$(installed-headers)) ! 341: installed-sysdep-headers-names = $(addprefix $(includedir)/,$($(systype)-installed-headers)) ! 342: install: install-headers install-kernel ! 343: ! 344: ifeq ($(force_install),yes) ! 345: instforce := FORCE ! 346: FORCE: ! 347: else ! 348: instforce := ! 349: endif ! 350: ! 351: $(installed-headers-names): $(includedir)/%: $(srcdir)/include/% $(instforce) ! 352: $(INSTALL_DATA) $< $@ ! 353: ! 354: $(installed-sysdep-headers-names): $(includedir)/%: $(sysdep)/include/% \ ! 355: $(instforce) ! 356: $(INSTALL_DATA) $< $@ ! 357: ! 358: install-headers: mkheaderdirs $(installed-headers-names) $(installed-sysdep-headers-names) ! 359: ln -sf $(systype) $(includedir)/mach/machine ! 360: ! 361: install-kernel: kernel mkkerneldirs ! 362: $(INSTALL_PROGRAM) kernel $(installed-kernel) ! 363: ! 364: mkheaderdirs: ! 365: mkdir -p $(includedir) $(includedir)/device $(includedir)/mach \ ! 366: $(includedir)/mach/$(systype) $(includedir)/mach/exec ! 367: ! 368: mkkerneldirs: ! 369: mkdir -p $(bootdir) ! 370: ! 371: ! 372: # ! 373: # Building the distribution ! 374: # ! 375: ! 376: dist: ! 377: rm -rf gnumach-$(version) ! 378: mkdir gnumach-$(version) ! 379: # Directories ! 380: mkdir gnumach-$(version)/{bogus,chips,ddb,device,ipc,kern,scsi,util,vm,include} ! 381: mkdir gnumach-$(version)/{doc,debian} ! 382: mkdir gnumach-$(version)/include/{mach,device,mach_debug,sys} ! 383: mkdir gnumach-$(version)/include/mach/exec ! 384: for dir in `cat $(all-archs-subdirs)`; do \ ! 385: mkdir -p gnumach-$(version)/$$dir; \ ! 386: done ! 387: # Files ! 388: cp $(addprefix $(srcdir)/,$(topfiles)) gnumach-$(version) ! 389: cp $(addprefix $(srcdir)/bogus/,$(bogus-files)) gnumach-$(version)/bogus ! 390: cp $(addprefix $(srcdir)/chips/,$(chips-files)) gnumach-$(version)/chips ! 391: cp $(addprefix $(srcdir)/ddb/,$(ddb-files)) gnumach-$(version)/ddb ! 392: cp $(addprefix $(srcdir)/device/,$(device-files)) gnumach-$(version)/device ! 393: cp $(addprefix $(srcdir)/ipc/,$(ipc-files)) gnumach-$(version)/ipc ! 394: cp $(addprefix $(srcdir)/kern/,$(kern-files)) gnumach-$(version)/kern ! 395: cp $(addprefix $(srcdir)/scsi/,$(scsi-files)) gnumach-$(version)/scsi ! 396: cp $(addprefix $(srcdir)/util/,$(util-files)) gnumach-$(version)/util ! 397: cp $(addprefix $(srcdir)/vm/,$(vm-files)) gnumach-$(version)/vm ! 398: cp $(addprefix $(srcdir)/include/,$(mach-headers)) gnumach-$(version)/include/mach ! 399: cp $(addprefix $(srcdir)/include/,$(device-headers)) gnumach-$(version)/include/device ! 400: cp $(addprefix $(srcdir)/include/,$(mach-debug-headers)) gnumach-$(version)/include/mach_debug ! 401: cp $(addprefix $(srcdir)/include/,$(mach-exec-headers)) gnumach-$(version)/include/mach/exec ! 402: cp $(addprefix $(srcdir)/include/,$(other-headers)) gnumach-$(version)/include ! 403: cp $(addprefix $(srcdir)/include/sys/,$(other-sys-headers)) gnumach-$(version)/include/sys ! 404: cp $(addprefix $(srcdir)/include/mach/,$(other-mach-headers)) gnumach-$(version)/include/mach ! 405: cp $(addprefix $(srcdir)/doc/,$(doc-files)) gnumach-$(version)/doc ! 406: cp $(addprefix $(srcdir)/debian/,$(debian-files)) gnumach-$(version)/debian ! 407: # Files in arch dirs ! 408: for file in `cat $(all-archs-files)`; do \ ! 409: cp $(srcdir)/$$file gnumach-$(version)/`dirname $$file`; \ ! 410: done ! 411: chmod -R u=rwX,og=rX gnumach-$(version) ! 412: tar cf - gnumach-$(version) | gzip -9vc > gnumach-$(version).tar.gz ! 413: rm -rf gnumach-$(version) ! 414: # XXX or... ! 415: # cd $(srcdir) && dpkg-buildpackage ! 416: ! 417: ! 418: ! 419: # ! 420: # Autoconf support ! 421: # ! 422: $(srcdir)/configure: $(srcdir)/configure.in ! 423: cd $(srcdir) && autoconf ! 424: $(srcdir)/config.h.in: $(srcdir)/configure.in ! 425: cd $(srcdir) && autoheader ! 426: ! 427: Makefile: $(srcdir)/Makefile.in config.status ! 428: ./config.status ! 429: config.h: stamp-configh ; ! 430: stamp-configh: $(srcdir)/config.h.in config.status ! 431: ./config.status ! 432: touch $@ ! 433: ! 434: config.status: $(srcdir)/configure ! 435: ./config.status --recheck ! 436: ! 437: vpath %.in $(srcdir) ! 438: vpath configure $(srcdir) ! 439: ! 440: ! 441: ! 442: # ! 443: # How to do some things ! 444: # ! 445: ! 446: # Building foo.h from foo.sym: ! 447: %.symc: %.sym $(srcdir)/gensym.awk ! 448: $(AWK) -f $(word 2,$^) $< > $@ ! 449: %.symc.o: %.symc $(before-compile) ! 450: $(CC) -S $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS-$@) -x c -o $@ $< ! 451: %.h: %.symc.o ! 452: sed <$< -e 's/^[^*].*$$//' | \ ! 453: sed -e 's/^[*]/#define/' -e 's/mAgIc[^-0-9]*//' >$@ ! 454: ! 455: # Building from foo.cli ! 456: %.h %_user.c: %.cli $(before-compile) ! 457: $(MIG) $(MIGFLAGS) -header $*.h -user $*_user.c -server /dev/null $< ! 458: ! 459: # Building from foo.srv ! 460: %_interface.h %_server.c: %.srv $(before-compile) ! 461: $(MIG) $(MIGFLAGS) -sheader $*_interface.h -server $*_server.c \ ! 462: -header /dev/null -user /dev/null $< ! 463: ! 464: # ! 465: # Dependency generation ! 466: # ! 467: ! 468: # Include dependency files ! 469: ifneq ($(no_deps),t) ! 470: ! 471: # For each file generated by MiG we need a .d file. ! 472: servers = $(filter %_server.o,$(objfiles)) ! 473: -include $(subst _server.o,.migs_d,$(servers)) /dev/null ! 474: -include $(subst _server.o,.migsh_d,$(servers)) /dev/null ! 475: ! 476: # vm_user.o fits the pattern, but is not actually a MiG-related file. ! 477: users = $(filter-out vm_user.o,$(filter %_user.o,$(objfiles))) ! 478: -include $(subst _user.o,.migu_d,$(users)) /dev/null ! 479: -include $(subst _user.o,.miguh_d,$(users)) /dev/null ! 480: ! 481: # For each .o file we need a .d file. ! 482: -include $(subst .o,.d,$(filter %.o,$(objfiles))) /dev/null ! 483: ! 484: endif ! 485: ! 486: # Here is how to make those dependency files ! 487: ! 488: %.migs_d: %.srv $(before-compile) ! 489: (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \ ! 490: sed -e 's/[^:]*:/$(@:.migs_d=_server.c) $@:/' > $@) ! 491: ! 492: %.migu_d: %.cli $(before-compile) ! 493: (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \ ! 494: sed -e 's/[^:]*:/$(@:.migu_d=_user.c) $@:/' > $@) ! 495: ! 496: %.migsh_d: %.migs_d ! 497: sed -e 's/_server\.c /_interface.h /' -e 's/migs_d/migsh_d/' < $< > $@ ! 498: ! 499: %.miguh_d: %.migu_d ! 500: sed -e 's/_user\.c /.h /' -e 's/migu_d/miguh_d/' < $< > $@ ! 501: ! 502: # Generic rule for $(CC) based compilation for making dependencies ! 503: define make-deps ! 504: set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M $< | \ ! 505: sed > [email protected] -e 's/$*\.o:/$*.o $@:/' ! 506: mv -f [email protected] $@ ! 507: endef ! 508: ! 509: %.d: %.c $(before-compile); $(make-deps) ! 510: %.d: %.S $(before-compile); $(make-deps) ! 511: ! 512: # .s files don't go through the preprocessor, so we do this ! 513: # This rule must come *after* the genuine ones above, so that ! 514: # make doesn't build a .s file and then make an empty dependency ! 515: # list. ! 516: %.d: %.s ! 517: echo '$*.o: $<' > $@
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.