# $Id: Makefile,v 1.5 1999/03/30 18:49:26 paradis Exp $
# $Log: Makefile,v $
# Revision 1.5  1999/03/30 18:49:26  paradis
# Remove bcopy (not needed for NT after all)
#
# Revision 1.4  1999/03/30 18:08:28  paradis
# Remove IDENTIFY entirely
# Remove memmove/memcpy from all Digital UNIX builds
# Add bcopy support
#
# Revision 1.3  1999/01/21 21:16:35  paradis
# Added cixes for Visual C++
# Added conditional compilation for DP264-specific stuff
# Removed fpu.c from WIN32 builds
#
# Revision 1.2  1999/01/21 19:05:04  gries
# First Release to cvs gries
#
# Revision 1.1.1.1  1998/12/29 21:36:12  paradis
# Initial CVS checkin
#
# Revision 1.74  1998/10/08  14:43:17  gries
# added ulcd.s for goldrush lcd
#
# Revision 1.72  1997/12/15  20:44:03  pbell
# Updated for dp264.
#
# Revision 1.71  1997/06/02  17:42:03  fdh
# Updated include file dependencies.
#
# Revision 1.70  1997/05/27  16:07:43  fdh
# Modified the assembler definitions.
#
# Revision 1.69  1997/05/23  13:19:16  fdh
# Added the fsboot module.
#
# Revision 1.68  1997/05/19  15:25:39  fdh
# Updated include file dependencies.
#
# Revision 1.67  1997/05/01  20:50:42  pbell
# Added dependencies for SX/LX support files.
#
# Revision 1.66  1997/04/23  18:16:50  fdh
# Updated include file dependencies.
#
# Revision 1.65  1997/04/23  18:13:02  fdh
# Updated include file dependencies.
#
# Revision 1.64  1997/04/10  17:04:36  fdh
# Modified the rule for making library archive.
#
# Revision 1.63  1997/03/26  15:02:25  pbell
# Removed rw.c.
#
# Revision 1.62  1997/03/17 10:23:29  fdh
# Moved stubs to the ../stubs directory.
# Modified to get the object file list from the source file list.
#
# Revision 1.61  1997/03/14  18:35:45  fdh
# Added ftype.c
#
# Revision 1.60  1997/03/12  15:59:22  fdh
# Added calloc.c
#
# Revision 1.59  1997/02/21  19:52:40  fdh
# Added ...     setjmp.s        scanf.c
#               puts.c          strtoul.c
#               strtod.c        atof.c
#               lx164_io.c      lx164mem.c
#               exit.c          fpu.c
#               rand.c          assert.c
#
# Revision 1.58  1996/07/11 16:07:07  fdh
# Added iobusini.c and updated include file dependencies.
#
# Revision 1.57  1996/06/18  03:07:31  fdh
# Updated include file dependencies.
#
# Revision 1.56  1996/05/26  20:21:25  fdh
# Updated include file dependencies.
#
# Revision 1.55  1996/05/26  20:04:33  fdh
# Added isa_dma.c
#
# Revision 1.54  1996/05/22  20:48:33  fdh
# Added targets sum.o and mcheck.o.
# Added pc164xxx.c to the source file lists.
#
# Revision 1.53  1996/02/20  18:47:15  cruz
# Added rule for new files and updated dependencies.
#
# Revision 1.52  1996/01/15  20:57:21  cruz
# Updated for filename change
#
# Revision 1.51  1995/12/24  02:42:30  fdh
# Removed biosdiag.
#
# Revision 1.50  1995/12/23  23:45:59  fdh
# Updated include file dependencies.
#
# Revision 1.49  1995/11/16  18:54:39  cruz
# Minor change.
#
# Revision 1.48  1995/11/03  22:12:39  cruz
# Added lint library to list of items to remove when
# performing a clean.
#
# Revision 1.47  1995/10/31  18:44:22  cruz
# Removed redefinition of LINTFLAGS
#
# Revision 1.46  1995/10/30  17:06:07  cruz
# Added lint rule.
#
# Revision 1.45  1995/10/21  06:20:53  fdh
# Updated include file dependencies.
#
# Revision 1.44  1995/10/21  05:28:23  fdh
# Added biosdiag.cxx.
#
# Revision 1.43  1995/10/18  14:19:02  cruz
# Added rule for prtrace.c
#
# Revision 1.42  1995/10/14  09:42:01  fdh
# Added stubs/stub_pci.c
#
# Revision 1.41  1995/10/13  20:06:43  fdh
# Renamed librom.a to rom.a.  i.e. same as directory name.
#
# Revision 1.40  1995/10/10  15:23:35  fdh
# Renamed eb64l to pc64.
#
# Revision 1.39  1995/10/05  01:55:45  fdh
# Updated include file dependencies.
#
# Revision 1.38  1995/10/04  23:41:29  fdh
# Updated include file dependencies.
#
# Revision 1.37  1995/10/03  03:47:09  fdh
# Removed sniff.c leds.c and added halp.c.
#
# Revision 1.36  1995/09/22  17:46:22  cruz
# Updated dependency list.
#
# Revision 1.35  1995/09/15  19:27:51  cruz
# Updated for new floppy files.
#
# Revision 1.34  1995/09/12  22:00:24  fdh
# Updated include file dependencies.
#
# Revision 1.33  1995/09/02  03:27:28  fdh
# Updated include file dependencies.
#
# Revision 1.32  1995/08/31  21:39:49  fdh
# Updated include file dependencies
#
# Revision 1.31  1995/08/25  20:49:43  fdh
# Fixed clean: target for stubs subdirectory.
#
# Revision 1.30  1995/08/25  19:47:20  fdh
# Removed ladbxusr.s, gpchar.c, uart.c and date.c and added time.c,
# tga.c, callbacks.c and stub modules (biosem, bios_dbg, cxx).
# Creates seperate stubs.a library.
#
# Revision 1.29  1995/08/07  17:36:47  fdh
# Rearranged object file lists... libc should be last.
#
# Revision 1.28  1995/07/06  14:50:56  cruz
# Removed extra switch.
#
# Revision 1.27  1995/07/05  18:58:39  cruz
# Added rules for compiling flash related files.
#
# Revision 1.26  1995/04/21  20:03:31  cruz
# Update dependency list
#
# Revision 1.25  1995/02/28  03:02:40  fdh
# Updated include file dependencies.
#
# Revision 1.24  1995/02/24  15:53:27  fdh
# Updated include file dependencies.
#
# Revision 1.23  1995/02/14  18:09:23  fdh
# Updated include file dependencies...
# ,.
#
# Revision 1.22  1995/02/08  01:36:41  fdh
# Updated include file dependencies...
#
# Revision 1.21  1994/12/08  17:49:38  fdh
# Added files for eb64l and eb66p and updated include file dependency
# lists.
#
# Revision 1.20  1994/11/24  04:30:53  fdh
# Updated include file dependency lists.
#
# Revision 1.19  1994/11/24  04:19:07  fdh
# Updated include file dependency list.
#
# Revision 1.18  1994/11/23  19:57:05  fdh
# Added eb164 files and updated dependency list.
#
# Revision 1.17  1994/11/23  15:42:56  fdh
# Modified include path definitions...
#
# Revision 1.16  1994/11/22  23:12:28  fdh
# Modified to use the INCDIR definition.
#
# Revision 1.15  1994/11/19  03:49:34  fdh
# Modified by make depend.
#
# Revision 1.14  1994/11/09  11:10:46  rusling
# Build cstartup.s using AS and not CC.
#
# Revision 1.13  1994/11/08  21:21:56  fdh
# Added flash.c and updated include file dependency list.
#
# Revision 1.11  1994/07/22  21:05:16  fdh
# Updated include file dependencies.
#
# Revision 1.10  1994/07/21  17:57:36  fdh
# Updated include file dependencies.
#
# Revision 1.9  1994/07/13  14:19:39  fdh
# Updated include file dependencies.
#
# Revision 1.8  1994/07/01  15:13:32  fdh
# Updated include dependencies...
#
# Revision 1.7  1994/06/28  20:11:24  fdh
# Modified filenames and build precedure to fit into a FAT filesystem.
#
# Revision 1.6  1994/06/20  14:59:32  fdh
# Fixup include file dependencies.
#
# Revision 1.5  1994/06/17  19:35:37  fdh
# Clean-up...
#
# Revision 1.4  1994/06/10  14:45:00  fdh
# Updated include file dependencies.
#
# Revision 1.3  1994/04/06  04:31:49  fdh
# Modified include dependencies for asmstuff.s
#
# Revision 1.2  1994/03/15  15:14:33  berent
# Added compilation of ladbxusr.s and did new  make depend
#
# Revision 1.1  1994/03/11  05:15:54  fdh
# Initial revision
#

CONFIG_DIR=../..
include $(CONFIG_DIR)/sdkmake.conf
include ../rules.gnu

# -------------------------------------------------
# Append local cc flags here for only this Makefile
# -------------------------------------------------
CCFLAGS = $(CCFLAGS_GLOBAL)

TARGET_SRCS = \
	$(SRCDIR)$(TARGET)_io.c \
	$(SRCDIR)$(TARGET)mem.c

ALL_TARGET_SRCS = $(ALLTARGETS/*/&_io.c &mem.c)

AS_SRCS  = \
	$(SRCDIR)asmstuff.s \
	$(SRCDIR)ulcd.s \
	$(SRCDIR)setjmp.s

C_SRCS   = \
	$(SRCDIR)iobusini.c \
	$(SRCDIR)beep.c \
	$(SRCDIR)c8514.c \
	$(SRCDIR)time.c \
	$(SRCDIR)acersio.c \
	$(SRCDIR)initdata.c \
	$(SRCDIR)fsboot.c \
	$(SRCDIR)floppy.c \
	$(SRCDIR)fileio.c \
	$(SRCDIR)fatdrv.c \
	$(SRCDIR)ident.c \
	$(SRCDIR)int.c \
	$(SRCDIR)kbd.c \
	$(SRCDIR)memtest.c \
	$(SRCDIR)p8514.c \
	$(SRCDIR)pr.c \
	$(SRCDIR)printf.c \
	$(SRCDIR)scanf.c \
	$(SRCDIR)puts.c \
	$(SRCDIR)strtoul.c \
	$(SRCDIR)strtod.c \
	$(SRCDIR)atof.c \
	$(SRCDIR)rom.c \
	$(SRCDIR)romhead.c \
	$(SRCDIR)search.c \
	$(SRCDIR)vga.c \
	$(SRCDIR)vgafont.c \
	$(SRCDIR)xlate.c \
	$(SRCDIR)pci.c \
	$(SRCDIR)halp.c \
	$(SRCDIR)flash.c \
	$(SRCDIR)mflash.c \
	$(SRCDIR)pflash.c \
	$(SRCDIR)28f008sa.c \
	$(SRCDIR)29f040.c \
	$(SRCDIR)tga.c \
	$(SRCDIR)string.c \
	$(SRCDIR)prtrace.c \
	$(SRCDIR)ctype.c \
	$(SRCDIR)calloc.c \
	$(SRCDIR)exit.c \
	$(SRCDIR)ftype.c \
	$(SRCDIR)rand.c \
	$(SRCDIR)assert.c \
	$(SRCDIR)smc.c \
	$(SRCDIR)sum.c \
	$(SRCDIR)mcheck.c \
	$(SRCDIR)isa_dma.c \
	$(SRCDIR)smcc669.c \
	$(SRCDIR)am29v800.c \
	$(SRCDIR)acersio.c \
	$(SRCDIR)amdflash.c \
	$(SRCDIR)memt.c \
	$(SRCDIR)callback.c

ifeq "$(EB_BUILD_SYSTEM)" "WINNT"
C_SRCS += $(SRCDIR)memcpy.c $(SRCDIR)memmove.c
endif

ifneq "$(EB_BUILD_SYSTEM)" "WINNT"
C_SRCS  += $(SRCDIR)fpu.c
endif

# For GNU make
OBJFILES = $(AS_SRCS:%.s=$(OBJDIR)%.$(OBJ)) $(TARGET_SRCS:%.c=$(OBJDIR)%.$(OBJ)) $(C_SRCS:%.c=$(OBJDIR)%.$(OBJ))

all:  $(OBJDIR)lib.$(LIBEXT) $(OBJDIR)cstartup.$(OBJ)

vars:
	@echo TARGET is $(TARGET)
	@echo TARGETDIR is $(TARGETDIR)
	@echo OBJDIR is $(OBJDIR)
	@echo SRCDIR is $(SRCDIR)
	@echo OBJFILES is $(OBJFILES)

#----------------
$(OBJDIR)cstartup.$(OBJ): cstartup.s
	$(AS) $(ASFLAGS) -o $@ -c $(INCLUDES) $<


ifeq "$(EB_BUILD_SYSTEM)" "WINNT"
$(OBJDIR)lib.$(LIBEXT): $(OBJFILES)
	$(DELETE) $(OBJDIR)lib.$(LIBEXT)
	$(LIBRARY) -VERBOSE -OUT:$(OBJDIR)lib.$(LIBEXT) $(OBJFILES)
else
$(OBJDIR)lib.$(LIBEXT): $(OBJFILES)
	$(DELETE) $(OBJDIR)lib.$(LIBEXT)
	$(AR) rcs $(OBJDIR)lib.$(LIBEXT) $(OBJFILES)
endif


#----------------------------------------------------------------------------
# Dependencies for individual files... we only specify those
# here that are not taken care of via the predefined rules
# in "rules.gnu"
#----------------------------------------------------------------------------
$(OBJDIR)asmstuff.$(OBJ):            asmstuff.s
	$(AS) $(ASFLAGS) -o $@ -c $(INCLUDES) $<

$(OBJDIR)ulcd.$(OBJ):                ulcd.s
	$(AS) $(ASFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)setjmp.$(OBJ):              setjmp.s
	$(AS) $(ASFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)iobusini.$(OBJ):            iobusini.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)beep.$(OBJ):                beep.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)c8514.$(OBJ):               c8514.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)time.$(OBJ):                time.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)initdata.$(OBJ):            initdata.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) \
	-DDBMENTRY=0x$(DBMENTRY) $< 

fsboot.$(OBJ) $(OBJDIR)fsboot.$(OBJ):     fsboot.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)floppy.$(OBJ):              floppy.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)fileio.$(OBJ):              fileio.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)fatdrv.$(OBJ):              fatdrv.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)ident.$(OBJ):               ident.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)int.$(OBJ):                 int.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)$(TARGET)_io.$(OBJ):        $(TARGET)_io.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)kbd.$(OBJ):                 kbd.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)$(TARGET)mem.$(OBJ):        $(TARGET)mem.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)memtest.$(OBJ):             memtest.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)p8514.$(OBJ):               p8514.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)pr.$(OBJ):                  pr.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)printf.$(OBJ):              printf.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)scanf.$(OBJ):               scanf.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)puts.$(OBJ):                puts.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)strtoul.$(OBJ):             strtoul.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)strtod.$(OBJ):              strtod.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)atof.$(OBJ):                atof.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)rom.$(OBJ):                 rom.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)romhead.$(OBJ):             romhead.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)search.$(OBJ):              search.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)vga.$(OBJ):                 vga.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)vgafont.$(OBJ):             vgafont.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)xlate.$(OBJ):               xlate.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)halp.$(OBJ):                halp.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)pci.$(OBJ):                 pci.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)flash.$(OBJ):               flash.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)mflash.$(OBJ):              mflash.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)pflash.$(OBJ):              pflash.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)28f008sa.$(OBJ):            28f008sa.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)29f040.$(OBJ):              29f040.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)tga.$(OBJ):                 tga.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)ctype.$(OBJ):               ctype.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)string.$(OBJ):              string.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)prtrace.$(OBJ):             prtrace.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)smc.$(OBJ):                 smc.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)sum.$(OBJ):                 sum.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)mcheck.$(OBJ):              mcheck.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)isa_dma.$(OBJ):             isa_dma.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)callback.$(OBJ):            callback.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)smcc669.$(OBJ):             smcc669.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)am29v800.$(OBJ):            am29v800.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)acersio.$(OBJ):            acersio.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)amdflash.$(OBJ):            amdflash.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)memt.$(OBJ):                memt.c
	$(CC) $(CCFLAGS) -DRPCC_TIMING -o $@ -c $(INCLUDES) $< 

$(OBJDIR)calloc.$(OBJ):              calloc.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)exit.$(OBJ):                exit.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)fpu.$(OBJ):                 fpu.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)ftype.$(OBJ):               ftype.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)rand.$(OBJ):                rand.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 

$(OBJDIR)assert.$(OBJ):              assert.c
	$(CC) $(CCFLAGS) -o $@ -c $(INCLUDES) $< 


#----------------------------------------------------------------------------

depend: $(AS_SRCS) $(C_SRCS) $(ALL_TARGET_SRCS)
	$(MAKEDEPEND) -p'$$(OBJDIR)' -- $(DEPENDFLAGS) -- \
	$(AS_SRCS) $(C_SRCS) $(ALL_TARGET_SRCS)

clean:
	$(DELETE) *~ \#*\# core ${MAKEFILE}.bak \
		$(OBJFILES) \
		$(OBJDIR)cstartup.$(OBJ) \
		$(OBJDIR)llib-llib.ln \
		$(OBJDIR)lib.$(LIBEXT)
	$(CLEAN)

distclean:      clean
	$(MAKEDEPEND) -f $(MAKEFILE)
	$(DELETE) $(MAKEFILE).bak

#----------------------------------------------------------------------------
# DO NOT DELETE THIS LINE -- make depend depends on it.

