#############################################################################
#
# gnu.mak - builds ZAF for vxWorks
#
#############################################################################

TOOL=gnu
#CPU=I80486
MD=mkdir

ADD_COMPILE_OPTIONS=-DUGL_OS_HEADER=uosVxw.h \
 -DUGL_ARCH_HEADER=$(UGL_ARCH_HEADER) -I$(CF_ZAF)/include
				      
TGT_DIR=$(WIND_BASE)/target

ifndef CPU
# you need to make sure that CPU is defined as an 
# environment variable or a macro
CPU=_CPU_not_defined_
endif

#-------------------------------------------------------------------
#
# CF-ZAF user configuration
#
ifndef DPC_INTERNAL
CF_CORE_SRC =	$(CF_ZAF)\src
CF_ZAF_SRC =	$(CF_ZAF)\src
else
#
# DPC internal configuration
#
INCLUDE=..\include;..\..\core\include;c:\zinc\include
CF_CORE_SRC =	c:\cf_zaf\src
CF_ZAF_SRC =	c:\cf_zaf\src
endif
#
#-------------------------------------------------------------------

include $(TGT_DIR)/h/make/defs.bsp
include $(TGT_DIR)/h/make/make.$(CPU)$(TOOL)
include $(TGT_DIR)/h/make/defs.$(WIND_HOST_TYPE)

default: 
exe: vxworks

.SUFIXES: .c .cpp

LIB_PARENT=..$(DIRCHAR)lib
LIB_DIR=..$(DIRCHAR)lib$(DIRCHAR)$(ZINC_COMPILER)

# Include ZAF source file definitions
include cfzfiles.mak

ADD_LINK_OPTIONS=
ADD_LIBRARY_OPTIONS=

include $(ZAF_ROOT)/include/make.gnu

vxworks: vxworks_libs

clean:
	$(RM) *.o
	$(RM) *.a

vxworks_libs: cfzVxW.a
	-$(MD) $(LIB_PARENT)
	-$(MD) $(LIB_DIR)
	$(CP) cfzVxW.a $(LIB_DIR)

CFZ_LIB_FILES=$(SOURCE_FILES)
cfzVxW.a: $(CFZ_LIB_FILES:%.cpp=%.o)
	-@$(RM) $@
	$(LIBRARIAN) $(LIBRARY_OPTIONS) $@ $^

#cfzVxW.o: $(CFZ_LIB_FILES:%.cpp=%.o)
#	-@$(RM) $@
#	$(LINKER) $(LINK_OPTIONS) -r -o temp.o $^
#	$(NM) temp.o | munch > munch.c
#	$(COMPILER) $(COMPILE_OPTIONS) -traditional munch.c
#	$(LINKER) -r -o $@ munch.o temp.o
#	$(RM) temp.o
#	$(RM) munch.c
#	$(RM) munch.o
