#### Start of system configuration section. ####

srcdir =	@srcdir@

ifeq ($(srcdir),.)
srcdir = ..
endif

VPATH :=	$(srcdir)

# Common prefix for machine-independent installed files.
prefix =	@prefix@

# Common prefix for machine-dependent installed files.
exec_prefix =	@exec_prefix@

bindir =	$(exec_prefix)/bin
libdir =	$(exec_prefix)/Sys/libs

INSTALL =	@INSTALL@
INSTALL_DATA =	@INSTALL_DATA@

CC =		@CC@
AS =		as

CFLAGS =	@CFLAGS@
LDFLAGS =	@LDFLAGS@

RANLIB =	@RANLIB@
AR =		ar
RM =		rm -f

#### End system configuration section ####

# BASE is defined to be either "no-baserel" or "baserel" by an upper level
# makefile.  The default is "no-baserel".

BASE =		no-baserel

FLAVOR_CFLAGS =
OTHER_CFLAGS =	-fomit-frame-pointer
ALL_CFLAGS =	$(CFLAGS) $(FLAVOR_CFLAGS) $(OTHER_CFLAGS) $(INCS)

INCS =		-I$(srcdir) -I$(srcdir)/../library -I$(srcdir)/../include
LIB =		libixglue.a
SHELL = 	/bin/sh

.c.o:
		$(CC) $(ALL_CFLAGS) -c $< -o $@

.s.o:
		cp $< x.c
		$(CC) $(CFLAGS) $(OTHER_CFLAGS) -traditional -E x.c -o x.s
		$(CC) $(CFLAGS) $(OTHER_CFLAGS) $(INCS) -c x.s -o $@
		$(RM) x.c x.s


all:		gen_glue $(LIB)

gen_glue:	gen_glue.c $(srcdir)/../include/sys/ixnet_syscall.def
		$(CC) $(ALL_CFLAGS) $< -o $@

$(LIB):         $(srcdir)/../include/sys/ixnet_syscall.def
		rm -f *.[os]
		./gen_glue
		for asm in *.s; do echo $$asm ; $(AS) -m68000 $$asm -o $$asm.o; done
		$(AR) rv $@ *.o
		rm -f *.[os]

clean:
		rm -rf *baserel

clobber:	clean
		rm -f Makefile
