#
# Makefile for utils
# for use with a unix hosted gcc based cross development system to produce
# minix format executables.
#
# - define CROSSDIR appropriately
# - define CC to be the path to your hosts C compiler (gcc preferred except on sparc
#	    on the sparc cc is the preferred host C compiler).
# - If you are going to run the cross linker on a machine that aligns structures
#   at longword boundaries (machines such as Sun-Sparc, Convex etc) add
#   -DWORD_ALIGNED to CFLAGS 
# - If you are going to run the cross linker on a machine that has the opposite
#    byte sex to a m68k, ie a little endian host, the add -DBYTE_SWAP to CFLAGS.
#
CROSSDIR = /net/acae127/home/bammi/atari/cross-minix
CROSSBIN = $(CROSSDIR)/bin
CROSSLIB = $(CROSSDIR)/lib
CROSSINC = $(CROSSDIR)/include

CC=$(CROSSBIN)/mgcc
CFLAGS = -O -I. -I$(CROSSINC) -Datariminix=1 -D__NO_PROTO__
# -D__OLD_OPEN_P__
LDFLAGS = -liio32

ALL = ld car nm

all: $(ALL)
#
# the 'regular' linker, produces atari executables
#

ld : ld.o cplusdem.o
	$(CC) -o ld ld.o cplusdem.o -v $(LDFLAGS)

ld.o : ld.c cplusdem.c gnu-ar.h gnu-out.h minix-out.h symseg.h
#oqsort.o : oqsort.c

car : ar.o
	$(CC) -o car ar.o -s  $(LDFLAGS)

ar.o : ar.c gnu-ar.h gnu-out.h

nm : nm.o cplusdem.o
	$(CC) -o nm nm.o cplusdem.o  $(LDFLAGS)

nm.o : nm.c gnu-ar.h gnu-out.h

clean:
	rm -f *.o

realclean: clean
	rm -f $(ALL) report core
