#	Makefile for c68 and c386
#
#	N.B.  Some modules will generate empty source files
#		according to the #define statements in config.h
#
#	As well as entries for c68 and c386, there are also
#	entries for the compilers that are typically used to
#	boot the c68/c386 compilers for the first time.
#--------------------------------------------------------
# Use the following if compiling c68/c386 with c68
#CC= cc68 -Qwarn=5 -D__STDC__=1
#LDFLAGS= -m250000
#--------------------------------------------------------
# Use the following if compiling c68/c386 with c386
# CC= cc386 -Qwarn=5 -D__STDC__=1
# LDFLAGS= -m250000
#--------------------------------------------------------
# Use the following if compiling c68 with ACK (68k version)
# CC= cc
# LDFLAGS= -m250000
#--------------------------------------------------------
# Use the following if compiling c68/c386 with GNU C
# CC= gcc
# LDFLAGS= -s -m250000
#--------------------------------------------------------
# Use the following if compiling c386 with bcc
# CC= bcc
# LDFLAGS =
#--------------------------------------------------------
# Use the following if compiling c68 with c68 on QDOS
#CC= cc -Qmaxerr=3 -Qwarn=8 -Qerror=3 -Qstackopt=3
#LDFLAGS = -bufp250K -ms
#--------------------------------------------------------
VPATH= ../
CFLAGS=  -pipe -DNDEBUG -O6 -s 

HDR = 	chdr.h cglbdec.h expr.h version.h config.h outproto.h
HDR386 =gen386.h
HDR386 =gen86.h
HDR68K =gen68k.h
HDRARM =genarm.h

#	Source files common to all versions of c68/c386
SRC = 	analyze.c cglbdef.c cmain.c decl.c expr.c extern.c genicode.c \
	genstmt.c genutil.c getsym.c init.c intexpr.c  list.c memmgt.c msgout.c \
	optimize.c outgen.c pragma_c stmt.c symbol.c system.c types.c

#	Source files specific to c68 680X0 versions
SRC68K =gen68k.c genffp.c genieee.c peep68k.c\
	out68k_a.c out68k_c.c out68k_g.c out68k_q.c reg68k.c

#	Source files specific to INTEL versions
SRCX86 =peepX86.c regX86.c \
	outX86_a.c outX86_b.c outX86_g.c outX86_s.c

#	Source files specific to c386 INTEL 386 versions
SRC386 =gen386.c

#	Source files specific to c386 INTEL 386 versions
SRC86  =gen86.c

#	Source files specific to carm ARM versions
SRCARM =genarm.c peeparm.c outarm_o.c regarm.c

#	The following is only required if your library does not
#	already contain this routine.
# SRCLIB = vfprintf.c
# OBJLIB = vfprintf.o
#	Use this setting if you already have vfprintf
SRCLIB =
OBJLIB =

#	Object files common to all c68/c386 variants
OBJ = 	analyze.o cglbdef.o cmain.o decl.o expr.o extern.o genicode.o \
	genstmt.o genutil.o getsym.o init.o intexpr.o  list.o memmgt.o msgout.o \
	optimize.o outgen.o stmt.o symbol.o system.o types.o

#	Object files specific to Motorola 680X0 variants
OBJ68K =gen68k.o genffp.o genieee.o peep68k.o\
	out68k_a.o out68k_c.o out68k_g.o out68k_q.o reg68k.o

#	Object files specific to INTEL variants
OBJX86 =peepX86.o regX86.o \
	outX86_a.o outX86_b.o outX86_g.o outX86_s.o

#	Object files specific to INTEL 386 variants
OBJ386 =gen386.o

#	Object files specific to INTEL 86 variants
OBJ86  =gen86.o

#	Object files specific to ARM variants
OBJARM =genarm.o peeparm.o outarm_o.o regarm.o

#	All object files
OBJS   =$(OBJ) $(OBJ68K) $(OBJX86) $(OBJ386) $(OBJ86) $(OBJARM)

LNS    =$(OBJS:.o=.ln)

.SUFFIXES:	.ln
.c.ln:
	lint $(CFLAGS) -m -u -c $<

all:	c68

c68:	$(OBJS)
	$(CC) $(CFLAGS) -o $@ $(OBJS) $(LIB)

lint:	$(LNS)
	lint $(LNS)

clean:
	rm -f *.ln *.o c68

$(OBJ):		$(HDR)
$(OBJ68K):	$(HDR) $(HDR68K)
$(OBJX86):	$(HDR) $(HDR386) $(HDR86)
$(OBJ386):	$(HDR) $(HDR386)
$(OBJ86):	$(HDR) $(HDR86)
$(OBJARM):	$(HDR) $(HDRASM)
