NASM?=nasm
NASMFLAGS=-Ox -I ../ -I ../../../lmacros/ -I ../../../scanptab/ \
 -I ../../bin/ -I ../../tmp/ -w+reloc-rel -w+error=reloc-rel
LZEXEDAT?=lzexedat.sh
HEATSHRINK?=heatshrink

LIBELDS =\
 ../../bin/extlib.eld \
 ../../bin/extpak.eld

ELDCOMP =\
 ../../bin/eldcomp.eld

ELDS =\
 ../../bin/aformat.eld \
 ../../bin/alias.eld \
 ../../bin/amiscmd.eld \
 ../../bin/amismsg.eld \
 ../../bin/amisoth.eld \
 ../../bin/amitsrs.eld \
 ../../bin/amount.eld \
 ../../bin/bases.eld \
 ../../bin/bootdir.eld \
 ../../bin/checksum.eld \
 ../../bin/chstool.eld \
 ../../bin/co.eld \
 ../../bin/config.eld \
 ../../bin/dbitmap.eld \
 ../../bin/devices.eld \
 ../../bin/dhm.eld \
 ../../bin/di.eld \
 ../../bin/dm.eld \
 ../../bin/doscd.eld \
 ../../bin/dosdir.eld \
 ../../bin/dosdrive.eld \
 ../../bin/dospwd.eld \
 ../../bin/dosseek.eld \
 ../../bin/dosspace.eld \
 ../../bin/dosstrat.eld \
 ../../bin/dpb.eld \
 ../../bin/dtadisp.eld \
 ../../bin/dx.eld \
 ../../bin/enamelib.eld \
 ../../bin/errfix.eld \
 ../../bin/extname.eld \
 ../../bin/hint.eld \
 ../../bin/hintoth.eld \
 ../../bin/history.eld \
 ../../bin/ifext.eld \
 ../../bin/inject.eld \
 ../../bin/instnoth.eld \
 ../../bin/instnoun.eld \
 ../../bin/kcmdline.eld \
 ../../bin/kdisplay.eld \
 ../../bin/ldmem.eld \
 ../../bin/ldmemoth.eld \
 ../../bin/linfo.eld \
 ../../bin/list.eld \
 ../../bin/patchqry.eld \
 ../../bin/path.eld \
 ../../bin/printf.eld \
 ../../bin/quiet.eld \
 ../../bin/quit.eld \
 ../../bin/rcexec.eld \
 ../../bin/rdumpidx.eld \
 ../../bin/rdumpstr.eld \
 ../../bin/reclaim.eld \
 ../../bin/reserve.eld \
 ../../bin/rm.eld \
 ../../bin/rn.eld \
 ../../bin/sbranch.eld \
 ../../bin/s.eld \
 ../../bin/set.eld \
 ../../bin/tsc.eld \
 ../../bin/useparat.eld \
 ../../bin/variable.eld \
 ../../bin/withhdr.eld \
 ../../bin/x.eld

MACS =\
 ../debug.mac \
 ../sections.mac \
 ../amis.mac \
 ../eld.mac \
 ../install.mac \
 ../iniload.mac \
 ../mzheader.mac \
 ../isvariab.mac \
 ../386.mac \
 ../options.mac \
 eldcall.mac elddata.mac eldcheck.mac ../nasmhash.mac

all: nonlib lib eldcomp

nonlib: $(ELDS)
lib: $(LIBELDS)
eldcomp: $(ELDCOMP)

.SUFFIXES: .eld .asm

../../bin/%.eld: %.asm $(MACS) eldlink.asm
	./makone.sh $* $(ELDOPTIONS)
#	$(NASM) $(NASMFLAGS) $(NASMOPTIONS) \
#		$*.asm -l ../../lst/$*.lst \
#		-D_MAP=../../lst/$*.map \
#		-o ../../bin/$*.eld -fbin

../../bin/extlib.eld: $(ELDS)
../../bin/extpak.eld: $(ELDS)

../../bin/bootdir.eld: dosdir.asm
# ../../bin/chstool.eld: scanptab.asm
../../bin/dbitmap.eld: font.asm
../../bin/dhm.eld: ../hmcb.mac
../../bin/di.eld: ../dishared.asm ../dimsg.asm
../../bin/dm.eld: ../dmshared.asm ../dmmsg.asm
../../bin/dx.eld: ../dxshared.asm
../../bin/eldtestc.eld: ../loadeld.asm
../../bin/eldtestd.eld: ../loadeld.asm
../../bin/extlib.eld: ../loadeld.asm depack.asm
../../bin/extpak.eld: extlib.asm ../loadeld.asm depack.asm
../../bin/hintoth.eld: hint.asm
../../bin/instnoth.eld: instnoun.asm
../../bin/ldmemoth.eld: ldmem.asm
../../bin/list.eld: depack.asm
../../bin/mcplib.eld: extlib.asm ../loadeld.aam depack.asm
../../bin/packlib.eld: extlib.asm $(ELDS)
../../bin/path.eld: ../isstring.asm ../pathshar.asm
../../bin/reclaim.eld: ../reclaims.asm
../../bin/rm.eld: ../rmshared.asm
../../bin/rn.eld: ../rnshared.asm ../fptostr.asm
../../bin/s.eld: ../ssshared.asm
../../bin/sbranch.eld: ../ssshared.asm
../../bin/testamis.eld: ../rmshared.asm
../../bin/x.eld: ../xxshared.asm ../xxmsg.asm ../help/ems.asm
