--- MiNT/src/makefile 2018/04/24 17:55:35 1.1.1.1 +++ MiNT/src/makefile 2018/04/24 17:56:15 1.1.1.3 @@ -4,19 +4,83 @@ # -#for 16 bit integers ONLY + + +# if you're cross-compiling, define NATIVECC + +# to the host's C compiler, NATIVECFLAGS to + +# the appropriate flags for it, and NATIVELIBS + +# to appropriate libraries + +# NATIVECC = cc -DNO_STDLIB + +# NATIVECFLAGS = -g + +# NATIVELIBS = + + + +NATIVECC = gcc + +NATIVECFLAGS = -O + +NATIVELIBS = -liio + + + +# + +# depending on your version of bison/yacc, you may + +# need to change these names, e.g. to + +# YACC = yacc + +# YTABC = y.tab.c + +# YTABH = y.tab.h + + + +YACC = bison -d + +YTABC = asm_tab.c + +YTABH = asm_tab.h + + + +# here are defs for the cross compiler + +# MiNT must be compiled with 16 bit integers + + + +CC = gcc + +AS = gcc MODEL = -mshort +MODEL030 = -mshort -m68020 + LIBS = -liio16 -CC = gcc +# add -DMULTITOS for a MultiTOS kernel + +# add -DONLY030 for a version of MiNT that needs a 680x0, x>=3 + + +DEFS = -DMULTITOS +#DEFS030 = -DMULTITOS -DONLY030 -DEFS = -DFASTTEXT -DZEROEXIT -DOWN_LIB +DEFS030 = -DONLY030 @@ -32,33 +96,33 @@ DEFS = -DFASTTEXT -DZEROEXIT -DOWN_LIB # -CFLAGS = -G -Wall -O -fomit-frame-pointer $(MODEL) $(DEFS) +CFLAGS = -G -Wall -O2 -fomit-frame-pointer $(MODEL) $(DEFS) +ASFLAGS = $(MODEL) +CFLAGS030 = -G -Wall -O2 -fomit-frame-pointer $(MODEL030) $(DEFS030) -# - -# directory where the .s files reside, plus a trailing slash. - -# You may need to change this to 'gas\\' or 'gas\', depending +ASFLAGS030 = $(MODEL030) -# on your version of make. +COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \ -ASM=gas/ + filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \ + biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \ + unifs.o shmfs.o fasttext.o welcome.o nalloc2.o memprot.o realloc.o -COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \ +COBJS030 = bios.o0 xbios.o0 console.o0 dos.o0 dosdir.o0 dosfile.o0 dosmem.o0 dossig.o0 \ - filesys.o main.o mem.o proc.o signal.o timeout.o tty.o util.o \ + filesys.o0 main.o0 mem.o0 proc.o0 signal.o0 timeout.o0 tty.o0 util.o0 \ - biosfs.o pipefs.o procfs.o tosfs.o debug.o rendez.o \ + biosfs.o0 pipefs.o0 procfs.o0 tosfs.o0 debug.o0 rendez.o0 \ - unifs.o shmfs.o fasttext.o + unifs.o0 shmfs.o0 fasttext.o0 welcome.o0 nalloc2.o0 memprot.o realloc.o0 @@ -68,22 +132,44 @@ CSRCS = bios.c xbios.c console.c dos.c d biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \ - unifs.c shmfs.c fasttext.c + unifs.c shmfs.c fasttext.c welcome.c nalloc2.c memprot.c realloc.c + +SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o -SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o +SOBJS030 = context.o0 intr.o0 syscall.o0 quickzer.o0 quickmov.o0 cpu.o0 OBJS = $(COBJS) $(SOBJS) +OBJS030 = $(COBJS030) $(SOBJS030) + + + +all: mint.prg mint030.prg + mint.prg: $(OBJS) $(CC) $(CFLAGS) -o mint.prg $(OBJS) $(LIBS) + prgflags 7 7 mint.prg + + strip mint.prg + + + +mint030.prg: $(OBJS030) + + $(CC) $(CFLAGS030) -o mint030.prg $(OBJS030) $(LIBS) + + prgflags 7 7 mint030.prg + + strip mint030.prg + $(SOBJS): proc.h @@ -92,47 +178,215 @@ $(COBJS): mint.h proc.h file.h +$(SOBJS030): proc.h + +$(COBJS030): mint.h proc.h file.h + + + main.o: version.h +welcome.o: version.h + +bios.o: inline.h + + + +memprot.o: memprot.c mint.h proc.h file.h + + $(CC) $(CFLAGS) -m68020 -c memprot.c + + + +main.o0: version.h + +welcome.o0: version.h + +bios.o0: inline.h + # -# assembler source files reside in their own directory, so that +# assembler source files are now handled in a radically different + +# fashion. We build a pre-processor program, asmtrans, that + +# takes the .spp files, merges them with an include file that + +# gives various offsets into structures of interest, and produces + +# the .s files as output. This has two major advantages: + +# (1) it lets us use the same source for both the Lattice and + +# gcc assembler files (the translator will convert), and + +# (2) if we change the CONTEXT or PROC structures, we don't + +# have to dig through the source code looking for + +# magic numbers + + + +# the asm translator program + +# Note that this must be compiled with the native CC of whatever + +# system you're using; see the definitions at the top of this + +# file. + + + +ATRANSOBJ = asmtab.o trutil.o trans.o + +ATRANS = asmtrans.ttp + + + +$(ATRANS): $(ATRANSOBJ) + + $(NATIVECC) $(NATIVECFLAGS) -o $(ATRANS) $(ATRANSOBJ) \ + + $(NATIVELIBS) + + + +asmtab.o: asmtab.c asmtrans.h + + $(NATIVECC) $(NATIVECFLAGS) -o $@ -c asmtab.c + + + +trutil.o: trutil.c asmtrans.h + + $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trutil.c + + + +trans.o: trans.c asmtrans.h + + $(NATIVECC) $(NATIVECFLAGS) -o $@ -c trans.c + + + + + +asmtab.c asmtab.h: asm.y + + $(YACC) asm.y + + mv $(YTABC) asmtab.c + + mv $(YTABH) asmtab.h + + + +# the magic number include file is generated automagically + +# NOTE that of course, magic.i can only reliably be generated + +# on an Atari ST; if you're cross-compiling, you'll have + +# to edit magic.i by hand + +# for cross compilers; uncomment the following definitions + +# and comment out the other ones below + + + +# for cross-compiling + + + +# GENMAGICPRG=echo + +# magic.i: proc.h file.h genmagic.c + +# echo "Warning: magic.i may be out of date" + + + +#for native compiling + + + +GENMAGICPRG=genmagic.ttp + + + +$(GENMAGICPRG): genmagic.c proc.h file.h + + $(CC) $(CFLAGS) -DGENMAGIC -o $(GENMAGICPRG) genmagic.c + + + +magic.i: $(GENMAGICPRG) + + $(GENMAGICPRG) $@ + -# different compilers are easily accounted for # +# assembler source files + +# + +.SUFFIXES: .spp .o0 + + + +.spp.o: + + $(ATRANS) $(DEFS) -gas -o $*.s $< + $(AS) $(ASFLAGS) -o $@ -c $*.s -context.o: $(ASM)context.s + $(RM) $*.s - $(CC) -c $(ASM)context.s -o context.o +.spp.o0: + $(ATRANS) $(DEFS030) -gas -o $*.s $< + $(AS) $(ASFLAGS0) -o $@ -c $*.s -intr.o: $(ASM)intr.s + $(RM) $*.s - $(CC) -c $(ASM)intr.s -o intr.o +.c.o0: + $(CC) $(CFLAGS030) -o $@ -c $< -syscall.o: $(ASM)syscall.s - $(CC) -c $(ASM)syscall.s -o syscall.o +context.o: context.spp magic.i $(ATRANS) +intr.o: intr.spp magic.i $(ATRANS) +syscall.o: syscall.spp magic.i $(ATRANS) -quickzer.o: $(ASM)quickzer.s +quickzer.o: quickzer.spp $(ATRANS) - $(CC) -c $(ASM)quickzer.s -o quickzer.o +quickmov.o: quickmov.spp $(ATRANS) +cpu.o: cpu.spp $(ATRANS) -quickmov.o: $(ASM)quickmov.s - $(CC) -c $(ASM)quickmov.s -o quickmov.o +context.o0: context.spp magic.i $(ATRANS) + +intr.o0: intr.spp magic.i $(ATRANS) + +syscall.o0: syscall.spp magic.i $(ATRANS) + +quickzer.o0: quickzer.spp $(ATRANS) + +quickmov.o0: quickmov.spp $(ATRANS) + +cpu.o0: cpu.spp $(ATRANS) @@ -156,3 +410,27 @@ proto.h: $(CSRCS) mkptypes $(CSRCS) >proto.h + + +# + +# macros for cleaning up + +# + +GENFILES= $(OBJS) $(OBJS030) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG) + +EXTRAS= asmtab.c asmtab.h mint.prg + + + +clean: + + $(RM) $(GENFILES) + + + +realclean: + + $(RM) $(GENFILES) $(EXTRAS) +