# My hack to exclude enet10 from library
#
# Buildfile for standalone support
#

ALL10=  maslen-libVsa10.a
ALL= $(ALL10) crt0.o xdeltacrt0.o

#ifdef X
VERSION=
#else
VERSION=
#endif X

INCLUDES = -I. -I../mi -I../../../libc/include/vax -I../../../libc/include/mi -I/xV/standalone/include

CFLAGS= -O $(VERSION) -DVAX -DENET10MEG -DMICROVAX -DSTANDALONE $(INCLUDES)

OBJECTS= Vsasu.o flushfill.o context.o misc.o emt.o ints.o initints.o
OBJECTS10= ikc10.o

# how to make a .o file from a .c file
.c.o:
	ccVAX $(CFLAGS) -c $*.c

# how to make a .o file from a .s file
.s.o:
	ccVAX $(CFLAGS) -c $*.s

# compile everything that needs it

all: $(ALL)

lint:
	lint $(CFLAGS) emt.c enet10.c ../mi/ikc.c \
		../mi/flushfill.c ../mi/context.c ../mi/misc.c

mvax.hs: ../../../libc/include/vax/ipl.h
	cp ../../../libc/include/vax/ipl.h tmp.c
	ccVAX -S tmp.c
	rm tmp.c
	mv tmp.s mvax.hs

crt0.o: crt0.s mvax.hs
	ccVAX $(CFLAGS) -DINITINTS -E crt0.s | ${AS} -o crt0.o
	-ld -x -r crt0.o
	mv a.out crt0.o
	chmod 664 crt0.o

xdeltacrt0.o: crt0.s mvax.hs
	ccVAX $(CFLAGS) -DINITINTS -DXDELTA -E crt0.s | ${AS} -o xdeltacrt0.o
	-ld -x -r xdeltacrt0.o
	mv a.out xdeltacrt0.o
	chmod 664 xdeltacrt0.o

# objects
#	Specific to 10Mb Ethernet version
enet10.o: enet10.c
	ccVAX $(CFLAGS) $(CFLAGS10) -c enet10.c
ikc10.o: ../mi/ikc.c
	ccVAX $(CFLAGS) $(CFLAGS10) -o ikc10.o -c ../mi/ikc.c

#	Binaries common to all versions.
Vsasu.o: Vsasu.c
	ccVAX $(CFLAGS) -c Vsasu.c
emt.o: emt.c
	ccVAX $(CFLAGS) -c emt.c

#	Machine independent binaries
flushfill.o: ../mi/flushfill.c
	ccVAX $(CFLAGS) -c ../mi/flushfill.c
context.o: ../mi/context.c
	ccVAX $(CFLAGS) -c ../mi/context.c
misc.o:	../mi/misc.c
	ccVAX $(CFLAGS) -c ../mi/misc.c

#	The "libraries"
maslen-libVsa10.a: $(OBJECTS) $(OBJECTS10)
	ld -T 0 -r -o maslen-libVsa10.a $(OBJECTS) $(OBJECTS10)

#	Samples of how to compile/load
test.o: ../mi/test.c
	ccVAX $(CFLAGS) -c ../mi/test.c

test10: test.o maslen-libVsa10.a
	ccVAX -o test10 test.o


# Standard buildfile entries
clean:
	rm -f *.o *.o *.s *.ls *.BAK *.CKP .emacs* .netupd* *.r \
		 *. *.d *.boot *.sym

install: all
	@echo "Can not install yet"
#ifdef X
#	netinstall -x "$(ALL)" /usr/sun/xlib 
#else
#	netinstall "$(ALL)" /usr/sun/lib
#endif X

build:
	buildmake

xbuild:
	buildmake -DX=1
