#; Content-Type: TEXT/PLAIN; charset=koi8-r
#;
#; This makefile contains:             - :
#;
#;                           make all
#;
#; - translate all sources and docs   -      
#; to UNIX-style and  KOI-8R.  Then   UNIX  -8R.     -
#; build all executables.              .
#;
#;                         make translate
#;
#; - Unpacking and translating  src       
#; distributing archive under  UNIX       UNIX  -
#; with Gnu C compiler.                 Gnu C.
#;
#; After this src\ dir contains so-      : src\  -
#; urces,   doc\  -  documentation,   , doc\ -  , cfg\  -
#; cfg  - sample  config  files  in     , ӣ -  UNIX-
#; UNIX-style text coding.                -8 .
#;
#;                          make archive
#;
#; - Building distributive archives      
#; under DOS with any make.exe  and         Gnu  
#; with Turbo C 2.0 compiler.          make.exe   TC2.0.
#;
#; (make from TC can't redirect cmd   (make.exe   2.0    -
#; line output)                         )
#;
#;                            make dos
#; - Building DOS distributive  ar-    DOS   ,
#; chive without sources, but  with       DOS 16   
#; DOS 16 and 32 bit executables.     DOS 32 bit (DPMI).
#;
#; NOTE!                              !
#; DOS, OS/2, Win32 versions do NOT   DOS, OS/2, Win32    -
#; use this file  to prepare compi-          
#; lation.                            .
#; 
#; ============================== Common section =============================
#;
#; Version definition.                 .
#;

include ./!version

#; ============================== UNIX section ===============================

.PHONY: translate

all:		exe/sqwish src/makefile

translate:	src/makefile

exe/sqwish:	src/makefile
	make --directory=src/ all

src/makefile:	exe/makeunix
	chmod +x exe/has
	exe/makeunix src/ dos/src/*.c
	exe/makeunix src/ dos/src/*.h
	exe/makeunix doc/ dos/doc/*
	exe/makeunix cfg/ dos/cfg/sq*.cfg
	exe/makeunix cfg/ dos/cfg/compress.cfg
	cp dos/cfg/msg*.cfg cfg/
	exe/makeunix src/ dos/src/make_gnu
	exe/makeunix src/ dos/src/sqw-area
	exe/makeunix src/ dos/src/sqw-verb
	exe/makeunix src/ dos/src/sqw-reas
	exe/makeunix src/ dos/src/makefile

#;
#; Build small recoding programm.       
#;

exe/makeunix:	dos/src/makeunix.c
	gcc -o exe/makeunix dos/src/makeunix.c

#; ============================== DOS section ================================
#;
#; Build small programms used in         , -
#; building process under DOS.             .

DOS\EXE\makelowe.exe:	DOS\SRC\makelowe.c
	D:\COMPILER\TC\tcc -mh -ID:\COMPILER\TC\INCLUDE -LD:\COMPILER\TC\LIB -eDOS\EXE\makelowe.exe DOS\SRC\makelowe.c
DOS\EXE\makeunix.exe:	DOS\SRC\makeunix.c
	D:\COMPILER\TC\tcc -mh -ID:\COMPILER\TC\INCLUDE -LD:\COMPILER\TC\LIB -eDOS\EXE\makeunix.exe DOS\SRC\makeunix.c

#;
#; Build  DOS  distributive archive       -
#; with DOS executables, sample cfg      ,  -
#; files, batch files and  documen-   ,      
#; tation (in one directory).         (  ).
#;

dos:		sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)d.zip

sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)d.zip: makefile DOS\file_id.diz
	del sqw-???d.zip
	del file_id.diz
	pkzip204 -rex sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)d.zip -x*.c -x*.h -xmake*.* -x*.emx -xsqw-*. -x*.zip -xhas. -xtoss. -x*.pkt
	pkzip204 -rpex sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)d.zip *.pkt

DOS\file_id.diz:	makefile
	@echo SqWish $(SQW_VERTYP)0$(SQW_VERSION).0$(SQW_SUBVERS) DOS16/32 exe config doc >dos\file_id.diz
	@echo FTN passthrough tosser: TwitFix,Rules >>dos\file_id.diz
	@echo extracting,PointSecure,unlim.msg size >>dos\file_id.diz

#;
#; Build full archive with sources          -
#; and documentation under DOS.         .
#;

file_id.diz:	makefile
	@echo SqWish $(SQW_VERTYP)0$(SQW_VERSION).0$(SQW_SUBVERS) Portable Sources+Docs >file_id.diz
	@echo FTN passthrough tosser: TwitFix,Rules >>file_id.diz
	@echo extracting,PointSecure;unlim.msg size >>file_id.diz

sqwish.zip:	archive

archive:	sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)s.zip

sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)s.zip:	.\makefile DOS\EXE\makelowe.exe DOS\EXE\makeunix.exe file_id.diz
	echo off
	del sqw-???s.zip
	del *.obj
	del dos\file_id.diz
	del dos\src\*.o
	del dos\src\*.obj
	del dos\src\*.bak
	del dos\src\*.map
	del dos\src\sqw-cfg.?
	del dos\src\hasher.exe
	del dos\src\t.t
	echo y|del src\*.*
	echo y|del doc\*.*
	echo y|del cfg\*.*
	@echo /* !version.h Automatically generated file */ >DOS\SRC\!version.h
	@echo \#define SQW_VERTYPE $(SQW_VERTYPE) >>DOS\SRC\!version.h
	@echo \#define SQW_VERSION $(SQW_VERSION) >>DOS\SRC\!version.h
	@echo \#define SQW_SUBVERS $(SQW_SUBVERS) >>DOS\SRC\!version.h
	@echo /* EOF !version.h */ >>DOS\SRC\!version.h
	move makefile.   ..\makefile.
	DOS\EXE\makeunix .\ ..\makefile.
	pkzip204 -rpex sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)s.zip -x*.exe -x*.zip -x*.com
	if exist ..\makefile. del makefile.
	if exist ..\makefile. move ..\makefile. .\makefile.
	DOS\EXE\makelowe sqw-$(SQW_VERTYP)$(SQW_VERSION)$(SQW_SUBVERS)s.zip

#;
#; ================== end of makefile =========================================
#;
