#********************************************************************
#**                     Microsoft Windows                          **
#**               Copyright(c) Microsoft Corp., 1992 - 1993        **
#********************************************************************

#
# GNU MAKE VERSION OF MAKEFILE FOR THE REFERENCE IMPL
#

ifneq (,)
This makefile requires GNU Make.
endif

include ../../commk.gcc

# the base directory where the code resides
BASE_DIR=.

# Put compiler specific flags in CFLAGS

# the inline warning is removed because GCC 2.6.2 cannot inline
# var arg functions (2.7.2 apparently does). Remove the -Wno-inline 
# from below if GCC supports that feature
DBG_FLAGS= -g -DDBG=1 -DDEVL=1
CFLAGS = $(DBG_FLAGS) -D_UNIX $(ADD_CFLAGS)

ifeq ($(U_OPTS),use_unicode)
        CFLAGS += -D_UNICODE=1                   
endif

# CRTINC is the location of the C runtime header files
CRTINC =  

# OSINC is the location of any operating system specific header files.
#  This reference implementation doesn't require any in its
#  unmodified form
OSINC =   

CINC = $(CRTINC) $(OSINC)

LIB=

#  The reference implementation needs a C runtime library
EXELIBS = ../../obj/refstg.a 

OBJDIR = obj

# for unix we only need one file since the we link with static libraries
CXXFILES=reftest.cxx

SOURCES= $(CXXFILES) $(HEADERS)
CXX_OBJS1=$(CXXFILES:%.cxx=./obj/%.o)
CXX_OBJS=$(CXX_OBJS1:%.c=./obj/%.o)

default: "$(OBJDIR)" $(OBJDIR)/reftest 

#clear all the files then build
clean: clobber default

# make etags for source browsing
tags: $(SOURCES)
	etags $(SOURCES) 
	
# clear all the files:
clobber:
	-@rm -rf $(OBJDIR)/*.o $(OBJDIR)/reftest

# make the directory 
"$(OBJDIR)":
	-@if [ ! -r $(OBJDIR) ]; then mkdir $(OBJDIR); fi

$(OBJDIR)/reftest: $(CXX_OBJS)
	$(CC) $(CXX_OBJS) $(EXELIBS) -o $@ 

$(OBJDIR)/%.o: %.c
	$(CC) -c $(CFLAGS) $(CINC) $< -o $@

$(OBJDIR)/%.o: %.cxx
	$(CC) -c $(CFLAGS) $(CINC) $< -o $@
