
#
#	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)/
PROTOS = $(OBJDIR)prog-protos.h
PRECOMP = $(OBJDIR)all.m
HEADER = all.h

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

# Source-files
SOURCES = main.c globals.c keyboard.c command.c io.c 	  filereq.c menu.c refs.c drexx.c hrexx.c search.c subs.c 	  clipboard.c block.c cursor.c text.c amiga.c var.c edit.c cmd.c 	  win.c prefs.c wildcmp.a swap.a
HEADERS = defs.h rexx.h
DOCFILES = docs/xdme.doc
SCRIPTFILES = S/.edrc

# Other files to delete at cleanup
OTHER = #?.bak
TARGETS = precomp
ARCHIVEFILES = DOCS S XDME_Project_File IMakefile

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

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

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

$(MKDIR) : $(MKDIR)
	mkdir $(MKDIR)

	tmp = $(OBJDIRS) $(MKDIR)
	OBJDIRS = $(tmp)

XDME : $(SOURCES:"*.c":"$(OBJDIR)*.o") $(SOURCES:"*.a":"$(OBJDIR)*.o")
	$(LN) -o XDME $(SOURCES:"*.c":"$(OBJDIR)*.o") $(SOURCES:"*.a":"$(OBJDIR)*.o") $(LNFLAGS) $(FLAGS) $(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) : $(HEADER)
	-$(DELETE) $(PRECOMP) $(DELETEFLAGS)

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

install_exe :
	$(COPY) $(INSTALLEXEFILES) TO $(BINDIR) $(COPYFLAGS)

resident :
	$(FOR) execname IN XDME DO resident $execname remove ";" resident $execname $(BINDIR)$execname add DONE

archive :
    cd /
    del XDME.lha
    lha -v9 -r -x -2 -a -Qh64 a XDME XDME 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)

# All rules to install anything
install : install_exe install_data install_script resident

# Create archive (needs tmp = $(ARCHIVES) $(ARCHIVEDIR).lha
	ARCHIVES = $(tmp)

$(ARCHIVEDIR).lha : $(ARCHIVEFILES)
	-$(DELETE) $(ARCHIVEDIR).lha $(DELETEFLAGS)
	$(ARCHIVER) $(ARCHIVEFLAGS) $(ARCHIVEDIR).lha $(ARCHIVEFILES)

archive : $(ARCHIVES)

# Cleanup-Stuff
clean :
	-$(DELETE) $(DELETEFILES) $(DELETEFLAGS)

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

