LIB = karmavx

library = ../lib$(LIB).a
lintlib = ../llib-l$(LIB).ln

.PRECIOUS: $(library)

include $(KARMAROOT)/source/lib/makefiles/GNUmakefile.h1
sourcedir = $(libdir)/master
lintdir = $(libdir)/lint

vpath %.c $(sourcedir)
vpath %.s $(sourcedir)/VXMVX

vpath %.h $(KARMAINCLUDEPATH)

CFLAGS = $(KOPTIMISE) -I$(KARMAINCLUDEPATH) -DFVERSION="$(KARMA_FVERSION)"

.c.o :
	vxcc -DOS_VXMVX -DMACHINE_i860 $(CFLAGS) -c $(sourcedir)/$*.c

.s.o :
	asm860 -be $(sourcedir)/VXMVX/$*.s -b

cs = $(wildcard $(sourcedir)/*.c)
csource = $(notdir $(cs))
cobjects = $(subst .c,.o,$(csource))
ssource = $(notdir $(wildcard $(sourcedir)/VXMVX/*.s))
sobjects = $(subst .s,.o,$(ssource))
objects =  $(cobjects) $(sobjects)
members = ${addprefix ${library}(,${addsuffix ),${objects}}}

.PHONY: all
all:	$(library) clean


$(library):	$(members)
	ranlib $(library)


lint:	$(lintlib)

$(lintlib):	$(csource)
	(cd $(libdir) ; make_lint)
	(cd .. ; lint -DOS_$(OS) -DMACHINE_$(MACHINE) -I$(KARMAINCLUDEPATH) -I$(VXHOME)/include -C$(LIB) $(lintdir)/*.c)


clean:
	\rm -f *~ *.bak


depend:
	(cd $(sourcedir); makedepend -DMAKEDEPEND -DOS_$(OS) -DMACHINE_$(MACHINE) -I$(KARMAINCLUDEPATH) -I$(VXHOME)/include -fdependfile -p$(library)"(" -o'.o)' $(cs)

include dependfile
