# -- only for FreeDOS !!, other DOSes don't need it, see the file
#    "makefile.djgpp_watt32" for them (unknown FreeDOS?? bug somewhere)
# -- also needs real FPU, emulators won't work (similar bug???)
#
#
# For a simple but tiny stand-alone .7z (LZMA only) decoder (.C srcs, public
# domain), check the LZMA SDK. I've compiled a few variants here (w/ srcs):
#
#      http://rugxulo.googlepages.com/7ZDEC.ZIP    (from LZMA SDK 4.65)
#
#
# P.S. Win32's 7ZA + HXRT ran on my 486 Sx last I checked, and faster too,
#      but DR-DOS' EMM386 /MULTI doesn't like that, hence one reason you may
#      prefer to use this one. Or maybe you like having full compiler and
#      runtime sources available for patching or like compiling on real
#      DOS with a commonly-available compiler, I dunno. Oh yeah, HXRT won't
#      run under CWSDPMI, so you can't use virtual memory. I'm telling
#      you your options just in case.
#
# ----------------------------------------------------------------------
# Building GNU pth:
#      doesn't work for me, despite changing "configure" to use
#      "pconf=/dev/env/TMPDIR" and only results in libpthsem.a which isn't
#      correct for whatever reason; bah, feel free to fix, I have no idea,
#      and there is no maintainer, hence I'm including /current/'s
#      pth207[bs].zip (since /beta/ is 686+ only!) with other sources
#      to make compiling easier, sorry !!
#
# Building Watt-32:
#      unzip watt32s-2.2-dev.10.zip
#      cd src
#      configur.bat djgpp
#      make -f djgpp.mak
# ----------------------------------------------------------------------

ifeq ($(WATT_ROOT),)
export WATT_ROOT=c:\armslurp\watt32
endif

ifeq ($(wildcard $(WATT_ROOT)/lib/libwatt.a),)
$(error Your WATT_ROOT dir is invalid, where's LIBWATT.A ???)
endif

ifeq ($(wildcard rugxulo_p7zip465.patch),)
$(error Where's the patch for FreeDOS ???)
endif

.PHONY : all

all:
# http://sourceforge.net/projects/p7zip
	cd p7zip_4.65
# using this makefile instead of a .BAT avoids the Vista UAC bug where
#   DJGPP's "patch" used inside .BAT triggers annoyingly / unavoidably
	patch -p1 < ..\rugxulo_p7zip465.patch
# replace default GNU/Linux makefile.machine (also avoids UAC for "update")
	update makefile.freedos makefile.machine
# 7zr is the .7z only version, and it compiles the fastest
# other targets available are "7za" (.7z .tar .gz .bz2 .zip) and "sfx"
	redir -t make 7zr
# stupid bogus extensionless *nix target file wastes space
	@-del bin\7zr
# LZMA compression on 7-Zip, how appropriate!  :-)
#	upx --best --lzma --all-filters bin\7zr.exe
	-upx --best --lzma bin\7zr.exe

# EOF    (rugxulo _AT_ gmail _DOT_ com)
