--- MiNT/src/makefile 2018/04/24 17:55:35 1.1.1.1 +++ MiNT/src/makefile 2018/04/24 17:55:39 1.1.1.2 @@ -4,49 +4,89 @@ # -#for 16 bit integers ONLY -MODEL = -mshort -LIBS = -liio16 +# if you're cross-compiling, define NATIVECC +# to the host's C compiler, NATIVECFLAGS to +# the appropriate flags for it, and NATIVELIBS -CC = gcc +# to appropriate libraries +# NATIVECC = cc -DNO_STDLIB +# NATIVECFLAGS = -g -DEFS = -DFASTTEXT -DZEROEXIT -DOWN_LIB +# NATIVELIBS = -# +NATIVECC = gcc -# if you have an older version of gcc, it won't understand -G; +NATIVECFLAGS = -O -# that won't hurt anything (it just controls the format of the +NATIVELIBS = -liio -# symbol table) so just delete the -G. Do *not* change it into -# -g!!! # -CFLAGS = -G -Wall -O -fomit-frame-pointer $(MODEL) $(DEFS) +# 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 + +MODEL = -mshort + +LIBS = -liio16 + + + +# add -DEZMINT for smaller MiNT + + + +DEFS = -DFASTTEXT -DOWN_LIB # -# directory where the .s files reside, plus a trailing slash. +# if you have an older version of gcc, it won't understand -G; -# You may need to change this to 'gas\\' or 'gas\', depending +# that won't hurt anything (it just controls the format of the -# on your version of make. +# symbol table) so just delete the -G. Do *not* change it into +# -g!!! +# -ASM=gas/ +CFLAGS = -G -Wall -O2 -fomit-frame-pointer $(MODEL) $(DEFS) @@ -72,7 +112,7 @@ CSRCS = bios.c xbios.c console.c dos.c d -SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o +SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o cpu.o @@ -94,45 +134,161 @@ $(COBJS): mint.h proc.h file.h main.o: version.h +bios.o: 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) -# different compilers are easily accounted for -# +asmtab.o: asmtab.c asmtrans.h + $(NATIVECC) $(NATIVECFLAGS) -o $@ -c $< -context.o: $(ASM)context.s - $(CC) -c $(ASM)context.s -o context.o +trutil.o: trutil.c asmtrans.h + $(NATIVECC) $(NATIVECFLAGS) -o $@ -c $< -intr.o: $(ASM)intr.s - $(CC) -c $(ASM)intr.s -o intr.o +trans.o: trans.c asmtrans.h + $(NATIVECC) $(NATIVECFLAGS) -o $@ -c $< -syscall.o: $(ASM)syscall.s - $(CC) -c $(ASM)syscall.s -o syscall.o -quickzer.o: $(ASM)quickzer.s +asmtab.c asmtab.h: asm.y - $(CC) -c $(ASM)quickzer.s -o quickzer.o + $(YACC) asm.y + mv $(YTABC) asmtab.c + mv $(YTABH) asmtab.h -quickmov.o: $(ASM)quickmov.s - $(CC) -c $(ASM)quickmov.s -o quickmov.o + +# 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) $@ + + + +# + +# assembler source files + +# + +.SUFFIXES: .spp + + + +.spp.s: + + $(ATRANS) -gas -o $@ $< + + + +context.o: context.spp magic.i $(ATRANS) + +intr.o: intr.spp magic.i $(ATRANS) + +syscall.o: syscall.spp magic.i $(ATRANS) + +quickzer.o: quickzer.spp $(ATRANS) + +quickmov.o: quickmov.spp $(ATRANS) + +cpu.o: cpu.spp $(ATRANS) @@ -156,3 +312,27 @@ proto.h: $(CSRCS) mkptypes $(CSRCS) >proto.h + + +# + +# macros for cleaning up + +# + +GENFILES= $(OBJS) $(ATRANSOBJ) $(ATRANS) $(GENMAGICPRG) + +EXTRAS= asmtab.c asmtab.h mint.prg + + + +clean: + + $(RM) $(GENFILES) + + + +realclean: + + $(RM) $(GENFILES) $(EXTRAS) +