!include Makefile.def

CURRDIR=.\\

!include makedefs.src

!include objdefs.dos

!include makedefs.files

ALLFLAGS = $(CFLAGS) -D$(CHARSET) -DSTDINCLUDES="$(INCDIR)" -DLIBDIR="$(LIBDIR)"

#---------------------------------------------------------------------------
# primary targets

all: $(ALLTARGETS)

docs: $(TEX2DOCTARGET) $(TEX2HTMLTARGET)
	cd doc_DE
	$(MAKE) TEX2DOC=..\$(TEX2DOCTARGET) TEX2HTML=..\$(TEX2HTMLTARGET) RM=del
	cd ..\doc_EN
	$(MAKE) TEX2DOC=..\$(TEX2DOCTARGET) TEX2HTML=..\$(TEX2HTMLTARGET) RM=del
	cd ..

$(ASLTARGET): $(AS_OBJECTS) $(ASM_OBJECTS) $(ST_OBJECTS) $(CODE_OBJECTS) $(NLS_OBJECTS)
        $(LD) @&&!
-ml $(OVR1FLAG) -e$(ASLTARGET)
$(AS_OBJECTS) $(ASM_OBJECTS)
$(ST_OBJECTS) $(NLS_OBJECTS)
$(OVR2FLAG) $(CODE_OBJECTS)
!

$(PLISTTARGET): $(PLIST_OBJECTS) $(NLS_OBJECTS)
        $(LD) @&&!
-ml -e$(PLISTTARGET)
$(PLIST_OBJECTS) n*.$(OBJEXTENSION)
!

$(PBINDTARGET): $(PBIND_OBJECTS) $(NLS_OBJECTS)
        $(LD) @&&!
-ml -e$(PBINDTARGET)
$(PBIND_OBJECTS) n*.$(OBJEXTENSION)
!

$(P2HEXTARGET): $(P2HEX_OBJECTS) $(NLS_OBJECTS)
        $(LD) @&&!
-ml -e$(P2HEXTARGET)
$(P2HEX_OBJECTS)
$(NLS_OBJECTS)
!

$(P2BINTARGET): $(P2BIN_OBJECTS) $(NLS_OBJECTS)
        $(LD) @&&!
-ml -e$(P2BINTARGET)
$(P2BIN_OBJECTS) n*.$(OBJEXTENSION)
!

$(RESCOMPTARGET): $(RESCOMP_OBJECTS)
	$(LD) -ml -e$(RESCOMPTARGET) $(RESCOMP_OBJECTS) $(LDFLAGS)

$(TEX2DOCTARGET): $(TEX2DOC_OBJECTS)
	$(LD) -ml -e$(TEX2DOCTARGET) $(TEX2DOC_OBJECTS) $(LDFLAGS)

$(TEX2HTMLTARGET): $(TEX2HTML_OBJECTS)
	$(LD) -ml -e$(TEX2HTMLTARGET) $(TEX2HTML_OBJECTS) $(LDFLAGS)

$(UNUMLAUTTARGET): $(UNUMLAUT_OBJECTS)
	$(LD) -ml -e$(UNUMLAUTTARGET) $(UNUMLAUT_OBJECTS) $(LDFLAGS)

#---------------------------------------------------------------------------
# special rules for objects dependant on string resource files

!include makedefs.str

#---------------------------------------------------------------------------
# supplementary targets

test: $(ALLTARGETS)
	cd tests
	copy t_secdri\wd1003at.inc t_secdri\lowlevel.inc
	testall
	cd ..

install: $(ALLTARGETS) $(UNUMLAUTTARGET)
	install $(BINDIR) $(INCDIR) $(MANDIR) $(LIBDIR) $(DOCDIR)

clean:
	del $(ALLTARGETS)
	del $(TEX2DOCTARGET)
	del $(TEX2HTMLTARGET)
	del $(RESCOMPTARGET)
	del *.$(OBJEXTENSION)
	del *.p
	del testlog
	del *.rsc
	cd doc_DE
	$(MAKE) RM=del clean
	cd ..\doc_EN
	$(MAKE) RM=del clean
	cd ..

#---------------------------------------------------------------------------
# create distributions

bindist: $(UNUMLAUTTARGET)
	mkdir as
	install as\bin as\include as\man as\lib as\doc
	cd as
	zip -9 -r ..\as$(VERSION) *.*
	cd ..
	deltree as

#---------------------------------------------------------------------------
# for my own use only...

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

.SUFFIXES: .c
.c.$(OBJEXTENSION):
	$(CC) $(ALLFLAGS) -c $*.c
