
#
#	This is an automatically generated DMakefile.
#
#	Do not change anything ! Edit "IMakefile" instead and
#
#	say "IMake"
#

# Directories for additional libs and includes
# OBJDIR is where .o files go to
# LIBS is for libs (i.e. "-lm -lrexxsys")
# INCLUDES is for include-files (i.e. "-Idcc:source/proj/include")
	 OBJDIR =
	   LIBS =
       INCLUDES =

# Flags for various command-invocations
# CCFLAGS - Flags for CC, ASFLAGS for assembler and LNFLAGS for linking
# FLAGS are global flags
# COPYFLAGS - flags for $(COPY) command
# dito for DELETEFLAGS and ARCHIVEFLAGS
	CCFLAGS =
	ASFLAGS =
	LNFLAGS =
	  FLAGS =
      COPYFLAGS = QUIET
    DELETEFLAGS = QUIET
   ARCHIVEFLAGS = -x -r a

# Directories for objs, executables, datafiles, docs, scripts, .lib, includes,
# Tools, Utilities, Prefs, ... . We need FULL Paths (incl. : and /)
	 TMPDIR = DTMP:
	 BINDIR = DCC:bin/
      CLIBINDIR = C:
       WBBINDIR = SYS:Tools/
	DATADIR = S:
	 DOCDIR = S:
      SCRIPTDIR = S:
	 LIBDIR = DLIB:
     INCLUDEDIR = DINCLUDE:
	TOOLDIR = SYS:Tools/
     UTILITYDIR = SYS:Utility/
       PREFSDIR = SYS:Prefs/
     ARCHIVEDIR =

# The user may set these: (DMake complains about unset variables)
# SOURCES - Source files (.c, .a, .o)
# HEADERS - *.h-files
# PROTOS - Files with Prototypes
# PRECOMP - Precompiled headerfiles
	SOURCES =
	HEADERS =
	 PROTOS =
	PRECOMP =
      DATAFILES =
    SCRIPTFILES =

# Other things our EXEC-File depends on
     EXECDEPEND =

# Name programs that do the jobs for us
	    DCC = dcc
	     CC = dcc -c
	     AS = dcc -c
	     LN = dcc
	   COPY = copy
	    FOR = for
       ARCHIVER = LhA
	 DELETE = delete
	   JOIN = join

# These change during the make. You may set them if you wish (i.e.
# to add a dependency to TARGETS or delete some other stuff or else
    DELETEFILES =
	TARGETS =
   ARCHIVEFILES =
      RESIDENTS =
INSTALLEXEFILES =
   DEPENDENCIES =
       ARCHIVES =
	OBJDIRS =

# Defines

# Include local defines. The User can set any of the above things to
# more suitable values, i.e. CLIBINDIR to "C:Tools/" instead of "C:"
# You may also redefine some Rules. (see below)

# Place all your local stubs here

        DATADIR = DATA:
         DOCDIR = DOC:
         BINDIR = DCC:bin/

#- Some defines that depend on users interaction
#- Rule: Make some files resident

#- Rules: Extract something from sourcevar

#- Rule: Link EXE-file

#- Rule: Compile C-Source. Also add source to archivefiles and obj-file
#-	     To Deletefiles

#- Rule: Compile ASM-Source. Also add files for archive/delete

#- Rule: Create Obj from some source(s). Sources may C or Asm. Also adds
#-	     files

#- Rule: Create lib from object-files. Also adds files for delete/archive

#- Create dir if it does not exist

#- Rule: Make one simple program from some source. Does all neccessary.

#- Rule: Create a complex program. Note that you have to create the exe-file
#-	     with other rules

#- Rule: Install DATA-Files

#- Rule: Install Script-Files

#- Rule for installing single EXE-Files

#- Rule: Install EXE-Files

#- Rule: How to create an archive.

#- Rule: How to create Prototypes

#- Rule: How to create precompiled headers

# Make sure that the dependency "all" is the first we encounter
all : all_after

#- Here we include the users makefile

MKDIR = $(TMPDIR)XDME
OBJDIR = $(MKDIR)/
LIBDIR = $(OBJDIR)
PROTOS = $(OBJDIR)prog-protos.h
PRECOMP = $(OBJDIR)all.m
HEADER = all.h

# Flags for cc
FLAGS = -proto -ms -s -r -mRR
CCFLAGS = -2.0 -I$(OBJDIR) -Iincludes -H$(PRECOMP)=$(HEADER) -//
LIBS = -ldebug -lrexxsys -lreqtools
#LIBS = -lrexxsys -lreqtools
LNFLAGS = -2.0

# Source-files
SOURCES1 = alias.c amiga.c block.c clipboard.c cmd.c command.c cursor.c    drexx.c edit.c filereq.c flags.c globals.c hrexx.c io.c keyaddes.c
SOURCES2 = keycodes.c keycom.c keycontrol.c keytables.c macros.c main.c    math.c mem.c menu_dme.c menucom.c menucontrol.c menustrips.c mikro.c
SOURCES3 = prefs.c redraw.c refs.c search.c simplex.c smallspc.c subs.c    text.c vars.c varsbases.c varstack.c win.c
SOURCESC = $(SOURCES1) $(SOURCES2) $(SOURCES3)
SOURCESA = wildcmp.a swap.a
SOURCES = $(SOURCESC) $(SOURCESA)
HEADERS = includes/defs.h includes/all.h includes/global.h
DOCFILES = docs/xdme.doc
SCRIPTFILES = S/.edrc

# Other files to delete at cleanup
OTHER = #?.bak
TARGETS = $(MKDIR) precomp

$(MKDIR) : $(MKDIR)
    makedir $(MKDIR)

tmp = $(TARGETS) XDME
	TARGETS = $(tmp)

	tmp = $(ARCHIVEFILES) XDME
	ARCHIVEFILES = $(tmp)

	tmp = $(INSTALLEXEFILES) XDME
	INSTALLEXEFILES = $(tmp)

XDME : $(SOURCES:"*.c":"$(OBJDIR)*.o") $(SOURCES:"*.a":"$(OBJDIR)*.o")
	$(LN) $(LNFLAGS) $(FLAGS) -o XDME $(SOURCES:"*.c":"$(OBJDIR)*.o") $(SOURCES:"*.a":"$(OBJDIR)*.o") $(LIBS)

$(SOURCES:"*.c":"$(OBJDIR)*.o") $(SOURCES:"*.a":"$(OBJDIR)*.o") : $(SOURCES:"*.c") $(SOURCES:"*.a")
	$(CC) -o %(left) %(right) $(CCFLAGS) $(FLAGS) $(INCLUDES)

	tmp = $(ARCHIVEFILES) $(SOURCES:"*.c") $(SOURCES:"*.a")
	ARCHIVEFILES = $(tmp)

	tmp = $(DELETEFILES) $(SOURCES:"*.c":"$(OBJDIR)*.o") $(SOURCES:"*.a":"$(OBJDIR)*.o")
	DELETEFILES = $(tmp)

protos : $(PROTOS)

$(PROTOS) : $(SOURCES)
	-$(DELETE) $(PROTOS) $(DELETEFLAGS)
	makeproto -o $(PROTOS) %(right)

	tmp = $(DELETEFILES) $(PROTOS)
	DELETEFILES = $(tmp)

precomp : $(PRECOMP)

$(PRECOMP) : $(HEADERS)
	-$(DELETE) $(PRECOMP) $(DELETEFLAGS)

	tmp = $(DELETEFILES) $(PRECOMP)
	DELETEFILES = $(tmp)

install :
    -delete C:Tools/XDME.old
    -rename C:Tools/XDME C:Tools/XDME.old
    copy XDME C:Tools
    resident DME C:Tools/XDME replace

# Global deps
$(SOURCESC:"*.c":"$(OBJDIR)*.o") $(SOURCESC:"*.a":"$(OBJDIR)*.o") :: $(HEADERS)

$(OBJDIR)keyhashes.o :: includes/defmap.h

clean :
    -delete $(OBJDIR)#? all $(DELETEFLAGS)

archive :
    cd /
    -delete XDME.lha.old
    -rename XDME.lha XDME.lha.old
    lha -v9 -r -x -a -Qh64 a XDME.lha @XDME/.archive XDME.info
    cd

# Here we have some things which are always found in the DMakefile
#- all depends on all_after which depends on $(TARGETS) which we
#- accumulated above. Note that we make sure all obj-dirs exist
all_after : $(OBJDIRS) $(TARGETS)

# Redo the DMakefile from an IMakefile (called by IMake).
# !!!! DO NOT USE THIS DEPEDENCY BY HAND !!!!
DMakefile : IMakefile
	dcpp -I$(DATADIR) $(DATADIR)DMakefile.tmpl -o DMakefile.neu
	cpp2make DMakefile.neu

