# $Id: makefile,v 1.5 2003/10/29 16:28:11 prokushev Exp $
#
# Root makefile for whatever may reside in subdirectories. Don't invoke the
# compiler directly from this file!
#
# wmake config    -> compile and install the build tools
# wmake [all]     -> build the project-related source code
# wmake install   -> create a distribution tree
# wmake snapshot  -> create snapshot of a source tree
# wmake docs      -> create web documentation
# wmake clean     -> clean source tree

UNCONFIGURED=1
ROOT=.
!include makefile.inc

all: .symbolic
!ifdef UNCONFIGURED
 $(MAKE) config
!endif
 cd src
 $(MAKE) $(MAKEFLAGS)
 cd ..
 $(MAKE) docs
 $(MAKE) snapshot

config: .symbolic
 %create config.inc
# cd >>config.inc
 %append config.inc LIBCPATH=
 %append config.inc UNCONFIGURED=
 -md bin
 -md bin\os2
 -md bin\os2\dll
 -md bin\os2\nls
 -md bin\os2\nls\book
 -md bin\os2\nls\msg
 -md lib
 cd src\toolkit
 $(MAKE) $(MAKEFLAGS)
 cd ..\shared
 $(MAKE) $(MAKEFLAGS)
 cd ..\cmd\shared
 $(MAKE) $(MAKEFLAGS)

snapshot: .symbolic
  if exist osfree-binaries.zip del osfree-binaries.zip
  if exist osfree-sources.zip del osfree-sources.zip
  if exist osfree-tools.zip del osfree-tools.zip
  cd bin
  pkzip /add /directories ..\osfree-binaries *
  cd ..
  pkzip /add /directories osfree-sources src\*
  pkzip /add osfree-sources makefile makefile.inc
  cd tools
  pkzip /add /directories ..\osfree-tools *
  cd ..

docs: .symbolic
 $(DOX) src\os.dxy
 $(ROOT)\tools\dox-postprocess.cmd
 $(ROOT)\tools\inf2php.cmd $(ROOT)

clean: .symbolic
 -del *.zip
 cd src
 $(MAKE) $(MAKEFLAGS) clean
 cd ..
 cd bin
 cd os2
 -del *.exe
 -del *.cmd
 -del *.sym
 cd nls
 cd msg
 -del *.msg
 -del *.ru
 -del *.pl
 cd ..
 cd book
 -del *.hlp
 -del *.inf
 cd ..
 cd ..
 cd ..
 cd ..
 cd lib
 -del *.lib
 cd ..
 cd tools
 -del hlldump.*
 cd ..
