#  This file is part of Jeeves4k, an application framework for
#  win32 / 100% assembler intro development.
#  Copyright (c) 2001 Kuno Woudt <warp-tmt@dds.nl>.
#
#  This Makefile is written for GNU make and requires NASM.
#  please consult the readme.txt for info and urls.
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 2 of the License, or
#  (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; see the file copying.txt; if not, write to
#  the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
#  Boston, MA  02111-1307  USA

         PACKAGE = Jeeves4k
         VERSION = 0.1.0

# the command.com in winnt doesn't like long filenames in
# some situations, so use `cmd' instead.

             CMD = command /c
#	     CMD = cmd /c
              RM = $(CMD) clean.bat
              CP = $(CMD) copy
           MKDIR = $(CMD) mkdir
           RMDIR = $(CMD) rmdir
        COMPRESS = /tools/apack/apack -v

             ASM = nasmw
        ASMFLAGS = -fobj
       STUBFLAGS = -fbin
      DEBUGFLAGS = -dDEBUG
            LINK = /prog/alink/alink.exe
      LINK_FLAGS = -c -oPE -m+ -subsys console
             LIB = /prog/alink/win32.lib

          source = jeeves.asm
            stub = stub.asm
     stub_target = stub.com
             inc = import.inc macros.inc opengl.inc win32n.inc \
		   blokken.inc
           extra = Makefile change.log copying.txt readme.txt \
                   dist.bat clean.bat
           final = bliss4k.com
          target = jeeves.exe
     debugtarget = jeevesd.exe
             obj = jeeves.obj
       debug_obj = jeevesd.obj

all: $(target)
debug: $(debugtarget)

release: $(final)

$(target) : $(obj)

$(obj) : $(source) $(inc)

$(debugtarget) : $(debug_obj)

$(debug_obj): $(source) $(inc)
	$(ASM) $(ASMFLAGS) $(DEBUGFLAGS)  $< -o $@

%.exe : %.obj
	$(LINK) $(LINK_FLAGS) $< $(LIB)

%.obj : %.asm
	$(ASM) $(ASMFLAGS) $< -o $@

$(final): $(stub_target)
	$(COMPRESS) $< $@

$(stub_target): $(stub) $(target)
	$(ASM) $(STUBFLAGS) $< -o $@

distclean: clean

clean:
	$(RM) $(target) $(debugtarget) $(obj) $(debug_obj) $(stub_target)

dist: all backup

backup: $(final)
#	dist.bat $(PACKAGE)-$(VERSION) $(source) $(stub) $(inc) $(extra) $(target)
	dist.bat $(PACKAGE)-$(VERSION) $(source) $(stub) $(inc) $(extra) $(final)
