#
# Makefile for MiNT using the GCC
#
#for 16 bit integers ONLY
MODEL = -mshort
LIBS = -liio16

CC = gcc

DEFS = -DFASTTEXT -DZEROEXIT -DOWN_LIB

#
# if you have an older version of gcc, it won't understand -G;
# that won't hurt anything (it just controls the format of the
# symbol table) so just delete the -G. Do *not* change it into
# -g!!!
#
CFLAGS = -G -Wall -O -fomit-frame-pointer $(MODEL) $(DEFS)

#
# directory where the .s files reside, plus a trailing slash.
# You may need to change this to 'gas\\' or 'gas\', depending
# on your version of make.

ASM=gas/


COBJS = bios.o xbios.o console.o dos.o dosdir.o dosfile.o dosmem.o dossig.o \
	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

CSRCS = bios.c xbios.c console.c dos.c dosdir.c dosfile.c dosmem.c dossig.c \
	filesys.c main.c mem.c proc.c signal.c timeout.c tty.c util.c \
	biosfs.c pipefs.c procfs.c tosfs.c debug.c rendez.c \
	unifs.c shmfs.c fasttext.c

SOBJS = context.o intr.o syscall.o quickzer.o quickmov.o

OBJS = $(COBJS) $(SOBJS)

mint.prg: $(OBJS)
	$(CC) $(CFLAGS) -o mint.prg $(OBJS) $(LIBS)

$(SOBJS): proc.h
$(COBJS): mint.h proc.h file.h

main.o: version.h

#
# assembler source files reside in their own directory, so that
# different compilers are easily accounted for
#

context.o: $(ASM)context.s
	$(CC) -c $(ASM)context.s -o context.o

intr.o: $(ASM)intr.s
	$(CC) -c $(ASM)intr.s -o intr.o

syscall.o: $(ASM)syscall.s
	$(CC) -c $(ASM)syscall.s -o syscall.o

quickzer.o: $(ASM)quickzer.s
	$(CC) -c $(ASM)quickzer.s -o quickzer.o

quickmov.o: $(ASM)quickmov.s
	$(CC) -c $(ASM)quickmov.s -o quickmov.o

#
# mkptypes generates prototypes from C source code. If you don't have it,
# you'll have to add/delete function prototypes by hand.
# also: Sozobon users will have to edit proto.h by hand to change the
#    #if defined(__STDC__) || defined(__cplusplus)
# line into
#    #if __STDC__
#
proto.h: $(CSRCS)
	mkptypes $(CSRCS) >proto.h
