|
|
1.1 root 1: # Makefile for Mach 4 kernel directory
2: # Copyright 1997 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:
1.1.1.2 ! root 23: installed-clib=@installed_clib@
1.1 root 24: exec_prefix=$(prefix)
25:
26: bootdir=$(exec_prefix)/boot
27: includedir=$(prefix)/include
28: libexecdir=$(exec_prefix)/libexec
29: bindir=$(exec_prefix)/bin
30:
31: sysdep = $(srcdir)/$(systype)
32:
33: cross_compiling=@cross_compiling@
1.1.1.2 ! root 34: cross_linkable=@cross_linkable@
! 35: ifeq ($(cross_linkable),yes)
! 36: cross-migcom = cross-migcom
! 37: endif
! 38:
! 39: # Detect if the user wants KDB
! 40: ifeq ($(findstring -DMACH_KDB,@DEFS@),-DMACH_KDB)
! 41: enable_kdb=yes
! 42: else
! 43: enable_kdb=no
! 44: endif
1.1 root 45:
46: # Programs found by configure.
47: AWK=@AWK@
48: INSTALL=@INSTALL@
49: CC=@CC@
50: BUILD_CC=@BUILD_CC@
51: LEX=@LEX@
52: YACC=@YACC@
53:
54: LEXLIB=@LEXLIB@
55:
56: INSTALL_PROGRAM=$(INSTALL)
57: INSTALL_DATA=$(INSTALL) -m 644
58:
59: CFLAGS=@CFLAGS@
60:
61: # We build these locally
1.1.1.2 ! root 62: MIG=./local-mig
1.1 root 63: MIGCOM=./migcom
64:
65: all:
66:
67: # All the possible architectures
68: all-archs = i386
69:
70: all-archs-subdirs = $(patsubst %,$(srcdir)/%/Subdirs,$(all-archs))
71: all-archs-files = $(patsubst %,$(srcdir)/%/Files,$(all-archs))
1.1.1.2 ! root 72: all-archs-configures = $(patsubst %,$(srcdir)/%/configure,$(all-archs))
1.1 root 73:
74: # Files distributed from the top level directory:
75: topfiles = ChangeLog ChangeLog.0 ChangeLog.00 Drivers.macros Makefile.in \
76: README INSTALL config.guess config.sub configure configure.in \
1.1.1.2 ! root 77: gensym.awk install-sh version.c NEWS aclocal.m4
1.1 root 78:
79: # All the source in each directory.
80:
81: # Old crud from a previous configure scheme
82: bogus-files = bootstrap_symbols.h fast_tas.h hw_footprint.h net_atm.h \
83: power_save.h simple_clock.h stat_time.h xpr_debug.h \
84: $(patsubst %,mach_%.h,assert counters debug fixpri host ipc_compat \
85: ipc_debug ipc_test kdb ldebug lock_mon machine_routines mp_debug \
86: pagemap pcsample ttd vm_debug) \
87: $(patsubst %,norma_%.h,device ether ipc task vm)
88:
89: # Generic code for various hardware drivers
90: chips-files = atm.c audio.c bt431.c bt455.c bt459.c build_font.c busses.c \
91: cfb_hdw.c cfb_misc.c dc503.c dtop_handlers.c dtop_hdw.c dz_hdw.c \
92: fb_hdw.c fb_misc.c fdc_82077_hdw.c frc.c ims332.c isdn_79c30_hdw.c \
93: kernel_font.c lance.c lance_mapped.c lk201.c mc_clock.c mouse.c \
94: nc.c nw_mk.c pm_hdw.c pm_misc.c scc_8530_hdw.c screen.c \
95: screen_switch.c serial_console.c sfb_hdw.c sfb_misc.c spans.c \
96: tca100.c tca100_if.c xcfb_hdw.c xcfb_misc.c \
97: atmreg.h audio_config.h audio_defs.h bt431.h bt455.h bt459.h \
98: bt478.h busses.h dc503.h dtop.h dz_7085.h dz_defs.h eccreg.h \
99: fdc_82077.h ims332.h isdn_79c30.h lance.h lk201.h mc_clock.h \
100: nc.h nw.h nw_mk.h pm_defs.h scc_8530.h screen.h screen_defs.h \
101: screen_switch.h serial_defs.h spans.h tca100.h tca100_if.h \
102: vs42x_rb.h xcfb_monitor.h
103:
104: # Generic code for various SCSI unit types
105: scsi-files = disk_label.c mapped_scsi.c pc_scsi_label.c rz.c rz_audio.c \
106: rz_cpu.c rz_disk.c rz_disk_bbr.c rz_host.c rz_tape.c scsi.c \
107: scsi_alldevs.c scsi_comm.c scsi_cpu.c scsi_disk.c scsi_jukebox.c \
108: scsi_optical.c scsi_printer.c scsi_rom.c scsi_scanner.c \
109: scsi_tape.c scsi_worm.c \
110: compat_30.h mapped_scsi.h rz.h rz_labels.h scsi.h scsi2.h \
111: scsi_defs.h scsi_endian.h
112:
113: # Icky kernel debugger
114: ddb-cfiles = $(addprefix db_,$(ddb-names))
115: ddb-names = access.c aout.c break.c command.c cond.c examine.c expr.c \
116: ext_symtab.c input.c lex.c macro.c mp.c output.c print.c run.c \
117: sym.c task_thread.c trap.c variables.c watch.c write_cmd.c
118: ddb-files = $(ddb-cfiles) $(patsubst %,db_%.h, \
119: access break command expr lex output print run sym task_thread \
120: variables watch) nlist.h stab.h tr.h
121:
122: # Device support interfaces
123: device-files = blkio.c chario.c cirbuf.c cons.c dev_lookup.c dev_name.c \
124: dev_pager.c device_init.c dk_label.c ds_routines.c net_io.c subrs.c \
125: buf.h cirbuf.h conf.h cons.h dev_hdr.h dev_master.h device_port.h \
126: device_types_kernel.h ds_routines.h errno.h if_ether.h if_hdr.h \
127: io_req.h net_io.h param.h tty.h memory_object_reply.cli \
128: dev_forward.defs device_pager.srv device_reply.cli device.srv
129:
130: # IPC implementation
131: ipc-cfiles = $(addprefix ipc_,$(ipc-names)) \
132: mach_msg.c mach_port.c mach_rpc.c mach_debug.c fipc.c
133: ipc-names = entry.c hash.c init.c kmsg.c marequest.c mqueue.c \
134: notify.c object.c port.c pset.c right.c space.c splay.c \
135: table.c target.c thread.c
136: ipc-files = $(ipc-cfiles) mach_port.srv fipc.h port.h mach_msg.h \
137: $(patsubst %,ipc_%.h, \
138: entry hash init kmsg kmsg_queue machdep marequest mqueue notify \
139: object port pset right space splay table target thread types)
140:
141: # "kernel" implementation (tasks, threads, trivia, etc.)
142: kern-cfiles = act.c ast.c bootstrap.c counters.c debug.c eventcount.c \
143: exception.c host.c ipc_host.c ipc_kobject.c ipc_mig.c ipc_sched.c \
144: ipc_tt.c kalloc.c lock.c lock_mon.c mach_clock.c mach_factor.c \
145: machine.c pc_sample.c printf.c priority.c processor.c profile.c \
146: queue.c sched_prim.c startup.c strings.c syscall_emulation.c \
147: syscall_subr.c syscall_sw.c task.c thread.c thread_swap.c \
148: time_stamp.c timer.c xpr.c zalloc.c elf-load.c
149: kern-files = $(kern-cfiles) \
150: act.h assert.h ast.h compat_xxx_defs.h counters.h cpu_number.h \
151: debug.h eventcount.h host.h ipc_host.h ipc_kobject.h ipc_sched.h \
152: ipc_tt.h kalloc.h kern_types.h lock.h mach_param.h macro_help.h \
153: pc_sample.h processor.h queue.h refcount.h sched.h sched_prim.h \
154: shuttle.h strings.h syscall_emulation.h syscall_subr.h syscall_sw.h \
155: task.h thread.h thread_swap.h time_out.h time_stamp.h timer.h xpr.h \
156: zalloc.h \
157: mach.srv mach4.srv mach_debug.srv mach_host.srv
158:
159: # Still more trivia
160: util-cfiles = about_to_die.c cpu.c cpu_init.c die.c putchar.c puts.c
161: util-files = $(util-cfiles) config.h cpu.h cpu_subs.h cpus.h debug.h \
162: phys_mem.h ref_count.h
163:
164: # Virtual memory implementation
165: vm-cfiles = $(addprefix vm_,$(vm-names)) memory_object.c
166: vm-names = debug.c external.c fault.c init.c kern.c map.c \
167: object.c pageout.c resident.c user.c
168: vm-files = $(vm-cfiles) memory_object_default.cli memory_object_user.cli \
169: memory_object.h pmap.h $(patsubst %,vm_%.h, \
170: external fault kern map object page pageout user)
171:
172:
173:
174: # Object files that go into the kernel image. (This will be augmented by the
175: # machine dependent Makefile fragment.)
176:
177: # Basic kernel source for Mach
178: objfiles := $(subst .c,.o,$(ipc-cfiles) $(kern-cfiles) \
179: $(util-cfiles) $(vm-cfiles))
180: vpath %.c $(srcdir)/ipc $(srcdir)/kern $(srcdir)/util $(srcdir)/vm
181:
182: # These device support files are always needed; the others are needed only
183: # if particular drivers want the routines.
184: # XXX functions in device/subrs.c should each be moved elsewhere
185: objfiles += cons.o dev_lookup.o dev_name.o dev_pager.o device_init.o \
186: ds_routines.o subrs.o net_io.o blkio.o chario.o
187: vpath %.c $(srcdir)/device
188:
189: # DDB support -- eventually to die. Please.
190: objfiles += $(subst .c,.o,$(ddb-cfiles))
191: vpath %.c $(srcdir)/ddb
192:
193: # Version number
194: objfiles += version.o
195: vpath version.c $(srcdir)
196:
197:
198: # Header files installed for user use
199: device-headers= $(addprefix device/,audio_status.h bpf.h device.defs \
200: device_reply.defs device_request.defs device_types.defs \
201: device_types.h disk_status.h net_status.h tape_status.h \
202: tty_status.h)
203: mach-headers= $(addprefix mach/, bootstrap.defs default_pager.defs \
204: default_pager_helper.defs default_pager_types.defs \
205: exc.defs mach.defs mach4.defs mach_host.defs mach_norma.defs \
206: mach_port.defs mach_types.defs memory_object.defs \
207: memory_object_default.defs norma_task.defs notify.defs \
208: std_types.defs \
209: alert.h boolean.h boot.h default_pager_types.h exception.h \
210: host_info.h kern_return.h mach_param.h mach_types.h \
211: machine.h macro_help.h memory_object.h message.h mig_errors.h \
212: msg_type.h multiboot.h norma_special_ports.h notify.h \
213: pc_sample.h policy.h port.h proc_ops.h processor_info.h \
214: profil.h profilparam.h rpc.h std_types.h syscall_sw.h \
215: task_info.h task_special_ports.h thread_info.h \
216: thread_special_ports.h thread_status.h thread_switch.h \
217: time_value.h version.h vm_attributes.h vm_inherit.h \
218: vm_param.h vm_prot.h vm_statistics.h inline.h)
219: mach-exec-headers= $(addprefix mach/exec/, a.out.h elf.h exec.h)
220: mach-debug-headers:= $(addprefix mach_debug/, hash_info.h ipc_info.h \
221: mach_debug.defs mach_debug_types.defs mach_debug_types.h \
222: pc_info.h vm_info.h zone_info.h)
223:
224: installed-headers:= $(device-headers) $(mach-headers) $(mach-exec-headers)
225:
226: # Other headers for the distribution. We don't install these, because the
227: # GNU C library has correct versions for users to use.
228: other-sys-headers := types.h time.h reboot.h ioctl.h
229: other-mach-headers := mig_support.h mach_traps.h error.h
230: other-headers := alloca.h
231:
232:
233: # We steal routines from the C library and put them here.
234: # If we link against the C library directly, then we have to hope that we have
235: # correctly found all the dependencies that might bring in C library code.
236: # This method is much safer because it's easy to check this one object file
237: # for sanity.
238: objfiles += clib-routines.o
239:
1.1.1.2 ! root 240: clib-routines := memcpy memset bcopy bzero htonl htons ntohl ntohs
! 241: ifeq ($(enable_kdb),yes)
! 242: clib-routines += strstr
! 243: endif
1.1 root 244:
245: clib-routines.o: $(installed-clib)
246: $(LD) -o clib-routines.o -r $(addprefix -u ,$(clib-routines)) $(installed-clib)
247:
248: # This rule checks clib-routines and makes sure it doesn't have any
249: # extra symbols.
250: kernel: check-clib-routines
251: check-clib-routines: clib-routines.o
1.1.1.2 ! root 252: nm -g $< | awk '$(foreach sym,$(clib-routines),$$3 == "$(sym)" ||) 0 { match_cnt++ } \
! 253: $$2 == "W" { weak_cnt++ } \
! 254: { total_cnt++ } \
! 255: END { exit total_cnt - (match_cnt + weak_cnt) } ' && touch check-clib-routines
1.1 root 256:
257:
258: # Empty dependency file
259: clib-routines.d:; touch $@
260:
261:
262:
263: # Automatically generated source
264:
265: # User stubs
266: objfiles += memory_object_user_user.o memory_object_default_user.o \
267: device_reply_user.o memory_object_reply_user.o
268:
269: # Server stubs
270: objfiles += device_server.o device_pager_server.o mach_port_server.o \
271: mach_server.o mach4_server.o mach_debug_server.o mach_host_server.o
272:
273: # Where to find the relevant Mig source files
274: vpath %.cli $(srcdir)/vm $(srcdir)/device
275: vpath %.srv $(srcdir)/device $(srcdir)/ipc $(srcdir)/kern
276:
277:
278:
279:
280: #
281: # Compilation flags
282: #
283:
1.1.1.2 ! root 284: DEFINES += -DMACH -DCMU -DMACH_KERNEL -DKERNEL @DEFS@
1.1 root 285: INCLUDES += -I. -I$(srcdir) -I$(srcdir)/include \
286: -I$(srcdir)/bogus -I$(srcdir)/util -I$(srcdir)/kern -I$(srcdir)/device
287:
288:
289: include $(sysdep)/Makefrag
290:
291: CPPFLAGS += -nostdinc $(DEFINES) $(INCLUDES)
292:
293: MIGFLAGS += $(CPPFLAGS)
294:
295:
1.1.1.2 ! root 296: # Standard targets
! 297:
! 298: all: kernel $(cross-migcom) cross-mig
! 299:
! 300: clean:
! 301: mv device-drivers.h FOO
! 302: rm -f *.o *.d kernel cross-migcom cross-mig migcom local-mig
! 303: rm -f *.symc *.symc.o *_user.c *_server.c *.h
! 304: rm -f *.migs_d *.migsh_d *.migu_d *.miguh_d
! 305: mv FOO device-drivers.h
! 306:
! 307: distclean: clean
! 308: rm -f config.status Makefile driverlist
! 309:
! 310: mostlyclean: distclean
! 311: rm -f $(srcdir)/mig/lexxer.c
! 312: rm -f $(srcdir)/mig/parser.c $(srcdir)/mig/parser.h
! 313:
! 314: maintainer-clean: mostlyclean
! 315: rm -f $(srcdir)/configure $(all-archs-configures)
! 316:
! 317: check:
1.1 root 318:
319:
320: #
321: # Kernel Image
322: #
323: # (The newline in this command makes it much easier to read in make output.)
324: kernel: $(objfiles)
325: $(LD) -o $@ $(LDFLAGS) \
326: $(objfiles)
327:
328:
329:
330: #
331: # Installation
332: #
333: installed-headers-names = $(addprefix $(includedir)/,$(installed-headers))
334: installed-sysdep-headers-names = $(addprefix $(includedir)/,$($(systype)-installed-headers))
1.1.1.2 ! root 335: install: mkinstalldirs kernel $(installed-headers-names) $(installed-sysdep-headers-names) cross-mig $(cross-migcom)
1.1 root 336: $(INSTALL_PROGRAM) kernel $(bootdir)/gnumach
337: $(INSTALL_PROGRAM) cross-mig $(bindir)/mig
1.1.1.2 ! root 338: test -z "$(cross-migcom)" || $(INSTALL_PROGRAM) cross-migcom $(libexecdir)/migcom
1.1 root 339: -ln -s $(systype) $(includedir)/mach/machine
340:
341: $(installed-headers-names): $(includedir)/%: $(srcdir)/include/%
342: $(INSTALL_DATA) $< $@
343:
344: $(installed-sysdep-headers-names): $(includedir)/%: $(sysdep)/include/%
345: $(INSTALL_DATA) $< $@
346:
347: mkinstalldirs:
348: mkdir -p $(bootdir) $(includedir) $(includedir)/device \
1.1.1.2 ! root 349: $(includedir)/mach $(includedir)/mach/$(systype) \
! 350: $(libexecdir) $(includedir)/mach/exec $(bindir)
1.1 root 351:
352:
353: #
354: # Building the distribution
355: #
356:
357: dist:
358: rm -rf gnumach-$(version)
359: mkdir gnumach-$(version)
360: # Directories
361: mkdir gnumach-$(version)/{bogus,chips,ddb,device,ipc,kern,mig,scsi,util,vm,include}
362: mkdir gnumach-$(version)/include/{mach,device,mach_debug,sys}
363: mkdir gnumach-$(version)/include/mach/exec
364: for dir in `cat $(all-archs-subdirs)`; do \
365: mkdir -p gnumach-$(version)/$$dir; \
366: done
367: # Files
368: ln $(addprefix $(srcdir)/,$(topfiles)) gnumach-$(version)
369: ln $(addprefix $(srcdir)/bogus/,$(bogus-files)) gnumach-$(version)/bogus
370: ln $(addprefix $(srcdir)/chips/,$(chips-files)) gnumach-$(version)/chips
371: ln $(addprefix $(srcdir)/ddb/,$(ddb-files)) gnumach-$(version)/ddb
372: ln $(addprefix $(srcdir)/device/,$(device-files)) gnumach-$(version)/device
373: ln $(addprefix $(srcdir)/ipc/,$(ipc-files)) gnumach-$(version)/ipc
374: ln $(addprefix $(srcdir)/kern/,$(kern-files)) gnumach-$(version)/kern
375: ln $(addprefix $(srcdir)/mig/,$(mig-files)) gnumach-$(version)/mig
376: ln $(addprefix $(srcdir)/scsi/,$(scsi-files)) gnumach-$(version)/scsi
377: ln $(addprefix $(srcdir)/util/,$(util-files)) gnumach-$(version)/util
378: ln $(addprefix $(srcdir)/vm/,$(vm-files)) gnumach-$(version)/vm
379: ln $(addprefix $(srcdir)/include/,$(mach-headers)) gnumach-$(version)/include/mach
380: ln $(addprefix $(srcdir)/include/,$(device-headers)) gnumach-$(version)/include/device
381: ln $(addprefix $(srcdir)/include/,$(mach-debug-headers)) gnumach-$(version)/include/mach_debug
382: ln $(addprefix $(srcdir)/include/,$(mach-exec-headers)) gnumach-$(version)/include/mach/exec
383: ln $(addprefix $(srcdir)/include/,$(other-headers)) gnumach-$(version)/include
384: ln $(addprefix $(srcdir)/include/sys/,$(other-sys-headers)) gnumach-$(version)/include/sys
385: ln $(addprefix $(srcdir)/include/mach/,$(other-mach-headers)) gnumach-$(version)/include/mach
386: # Files in arch dirs
387: for file in `cat $(all-archs-files)`; do \
388: ln $(srcdir)/$$file gnumach-$(version)/`dirname $$file`; \
389: done
390: for arch in $(all-archs); do \
391: ln -s $$arch gnumach-$(version)/$$arch/include/mach/machine; \
392: done
393: tar cfz gnumach-$(version).tar.gz gnumach-$(version)
394: rm -rf gnumach-$(version)
395:
396:
397:
398: #
399: # Autoconf support
400: #
401: $(srcdir)/configure: configure.in
402: cd $(srcdir) && autoconf
403:
404: Makefile: Makefile.in config.status
405: ./config.status
406:
407: config.status: configure
408: ./config.status --recheck
409:
410: vpath %.in $(srcdir)
411: vpath configure $(srcdir)
412:
413:
414:
415: #
416: # How to do some things
417: #
418:
419: # Building foo.h from foo.sym:
420: %.symc: %.sym
421: $(AWK) -f $(srcdir)/gensym.awk $< >$*.symc
422: %.symc.o: %.symc
423: $(CC) -S $(CPPFLAGS) $(CFLAGS) $(CPPFLAGS-$@) -x c -o $@ $<
424: %.h: %.symc.o
425: sed <$< -e 's/^[^*].*$$//' | \
426: sed -e 's/^[*]/#define/' -e 's/mAgIc[^-0-9]*//' >$@
427:
428: # Building from foo.cli
429: %.h %_user.c: %.cli $(MIG) $(MIGCOM)
430: $(MIG) $(MIGFLAGS) -header $*.h -user $*_user.c -server /dev/null $<
431:
432: # Building from foo.srv
433: %_interface.h %_server.c: %.srv $(MIG) $(MIGCOM)
434: $(MIG) $(MIGFLAGS) -header $*_interface.h -server $*_server.c -user /dev/null $<
435:
436: #
437: # Dependency generation
438: #
439:
440: # Include dependency files
441: ifneq ($(no_deps),t)
442:
443: # For each file generated by MiG we need a .d file.
444: servers = $(filter %_server.o,$(objfiles))
445: include $(subst _server.o,.migs_d,$(servers)) /dev/null
446: include $(subst _server.o,.migsh_d,$(servers)) /dev/null
447:
448: # vm_user.o fits the pattern, but is not actually a MiG-related file.
449: users = $(filter-out vm_user.o,$(filter %_user.o,$(objfiles)))
450: include $(subst _user.o,.migu_d,$(users)) /dev/null
451: include $(subst _user.o,.miguh_d,$(users)) /dev/null
452:
453: # For each .o file we need a .d file.
454: include $(subst .o,.d,$(filter %.o,$(objfiles))) /dev/null
455:
456: endif
457:
458: # Here is how to make those dependency files
459:
460: %.migs_d: %.srv
461: (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \
462: sed -e 's/\.srv\.o:/_server.c $@:/' > $@)
463:
464: %.migu_d: %.cli
465: (set -e; $(CPP) $(MIGFLAGS) -M -MG -x c $< | \
466: sed -e 's/\.cli\.o:/_user.c $@:/' > $@)
467:
468: %.migsh_d: %.migs_d
469: sed -e 's/_server\.c /_interface.h /' -e 's/migs_d/migsh_d/' < $< > $@
470:
471: %.miguh_d: %.migu_d
472: sed -e 's/_user\.c /.h /' -e 's/migu_d/miguh_d/' < $< > $@
473:
474: # Generic rule for $(CC) based compilation for making dependencies
475: define make-deps
476: set -e; $(CC) $(CFLAGS) $(CPPFLAGS) -M -MG $< | \
477: sed > [email protected] -e 's/$*\.o:/$*.o $@:/'
478: mv -f [email protected] $@
479: endef
480:
481: %.d: %.c; $(make-deps)
482: %.d: %.S; $(make-deps)
483:
484: # .s files don't go through the preprocessor, so we do this
485: # This rule must come *after* the genuine ones above, so that
486: # make doesn't build a .s file and then make an empty dependency
487: # list.
488: %.d: %.s
489: echo '$*.o: $<' > $@
490:
491:
492: # How to build MiG:
493:
494: mig-objfiles = error.o global.o header.o lexxer.o migcom.o parser.o routine.o \
495: server.o statement.o string.o type.o user.o utils.o
496: mig-csrcfiles = $(subst .o,.c,$(mig-objfiles))
497: mig-othersrc = alloc.h boolean.h error.h global.h lexxer.h message.h \
498: mig_string.h routine.h statement.h type.h utils.h write.h \
499: lexxer.l parser.y mig.sh parser.h cpu.sym
500:
1.1.1.2 ! root 501: cross-lexxer.o lexxer.o: cpu.h
! 502:
1.1 root 503: mig-files = $(mig-csrcfiles) $(mig-othersrc) ChangeLog
504:
505: vpath cpu.sym $(srcdir)/mig
506:
1.1.1.2 ! root 507: ifeq ($(cross_linkable),yes)
1.1 root 508: # Don't use $(CPPFLAGS) here; MiG needs none of the Mach headers except
509: # what happens automagically to build cpu.h.
510:
511: # Here's how to build MiG for the target.
512: cross-mig-objfiles = $(addprefix cross-,$(mig-objfiles))
513:
514: $(cross-mig-objfiles): cross-%.o: $(srcdir)/mig/%.c
515: $(CC) -c $(CFLAGS) -I. -I$(srcdir)/mig -o $@ $<
516:
517: ./cross-migcom: $(cross-mig-objfiles)
518: $(CC) $(CFLAGS) $(cross-mig-objfiles) $(LEXLIB) -o $@
519:
520: # Dependencies for these .o files
521: ifneq ($(no_deps),t)
522: include $(subst .o,.d,$(cross-mig-objfiles)) /dev/null
523: endif
524:
525: $(subst .o,.d,$(cross-mig-objfiles)): cross-%.d: $(srcdir)/mig/%.c
526: set -e; $(CC) $(CFLAGS) -M -MG -I. -I$(srcdir)/mig $< | \
527: sed > [email protected] -e 's/$*\.o:/cross-$*.o $@:/'
528: mv -f [email protected] $@
1.1.1.2 ! root 529: endif
1.1 root 530:
531: ifeq ($(cross_compiling),yes)
532: # When cross compiling, we build two migcoms; one for our use and one to
533: # install. Otherwise, we just build the one.
534:
535: $(mig-objfiles): %.o: $(srcdir)/mig/%.c
536: $(BUILD_CC) -c $(BUILD_CFLAGS) -I. -I$(srcdir)/mig -o $@ $<
537:
538: ./migcom: $(mig-objfiles)
539: $(BUILD_CC) $(BUILD_CFLAGS) $(mig-objfiles) $(LEXLIB) -o $@
540:
541: ifneq ($(no_deps),t)
542: include $(subst .o,.d,$(mig-objfiles))
543: endif
544:
545: $(subst .o,.d,$(mig-objfiles)): %.d: $(srcdir)/mig/%.c
546: set -e; $(BUILD_CC) $(BUILD_CFLAGS) -M -MG -I. -I$(srcdir)/mig $< | \
547: sed > [email protected] -e 's/$*\.o:/$*.o $@:/'
548: mv -f [email protected] $@
549:
550: else
551: ./migcom: ./cross-migcom
552: rm -f $@
553: ln $< $@
554: endif
555:
556: $(srcdir)/mig/lexxer.c: $(srcdir)/mig/lexxer.l
557: $(LEX) $(LFLAGS) $<
558: mv lex.yy.c $*.c
559:
560: $(srcdir)/mig/parser.c $(srcdir)/mig/parser.h: $(srcdir)/mig/parser.y
561: $(YACC) $(YFLAGS) -d $<
562: mv y.tab.c $(srcdir)/mig/parser.c
563: mv y.tab.h $(srcdir)/mig/parser.h
564:
565: # Version of mig script that looks for the right local tools
566: ifeq ($(cross_compiling),yes)
1.1.1.2 ! root 567: ./local-mig: $(srcdir)/mig/mig.sh Makefile
1.1 root 568: sed -e 's,@MIGDIR@,.,g' \
569: -e 's,@CPP@,${BUILD_CC} -x c-header -E,g' \
570: $< >[email protected] && chmod +x [email protected] && mv -f [email protected] $@
571: else
1.1.1.2 ! root 572: ./local-mig: $(srcdir)/mig/mig.sh Makefile
1.1 root 573: sed -e 's,@MIGDIR@,.,g' \
574: -e 's,@CPP@,${CC} -x c-header -E,g' \
575: $< >[email protected] && chmod +x [email protected] && mv -f [email protected] $@
576: endif
577:
1.1.1.2 ! root 578: # Version of MiG to install
! 579: cross-mig: $(srcdir)/mig/mig.sh Makefile
! 580: sed -e 's,@MIGDIR@,$(libexecdir),g' \
! 581: -e 's,@CPP@,${CC} -x c-header -E,g' \
! 582: $< >[email protected] && chmod +x [email protected] && mv -f [email protected] $@
! 583:
! 584:
! 585: # The first time through, Make will try and build MiG to get
! 586: # dependencies, before it knows about the automatically generated
! 587: # files that MiG needs. So tell it about that file here.
! 588: cross-lexxer.o lexxer.o: cpu.h
1.1 root 589:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.