1# -*-sh-*-
2
3# mingw32-make is used for both 32 and 64 bit builds.
4MAKE = mingw32-make
5
6# Note: copy.exe does not exist on windows since it is a cmd.exe built-in
7# The same appears to be true for del.
8MFLAGS = COPY="cmd /c copy /y" RM="cmd /c del"
9
10# DESTDIR is used for building a package for use on another machine.
11DESTDIR =
12
13# PREFIX controls where the library will be installed.
14PREFIX = C:/mingw/local
15CONFDIR = $(PREFIX)/etc
16#
17SLSH_DEFS = SLSH_CONF_DIR=$(CONFDIR) SLSH_LIB_DIR=$(PREFIX)/share/slsh
18SLANG_DEFS = prefix=$(PREFIX)
19
20all:
21	cd src && $(MAKE) $(MFLAGS) $(SLANG_DEFS)
22	cd slsh && $(MAKE) $(MFLAGS) $(SLSH_DEFS)
23	cd modules && $(MAKE) $(MFLAGS)
24	@echo .
25	@echo To install it, run $(MAKE) install.
26	@echo .
27#
28clean:
29	cd src && $(MAKE) $(MFLAGS) clean
30	cd slsh && $(MAKE) $(MFLAGS) clean
31	cd modules && $(MAKE) $(MFLAGS) clean
32#
33# Note the use of X- below.  Windows regards '=' as a commandline whitespace
34# character and needs to be quoted.  However I have not been able to figure
35# out how to do that in the context of the mingw32-make command parser.
36# As a major hack, I added the X- prefix and modified mkfiles/install.sl
37# to remove the X-.
38#
39# If the command below fails with an error message involving /usr/bin/sh, then
40# change "mkfiles\runslsh.bat" to "mkfiles/runslsh.bat"
41install: all
42	mkfiles\runslsh.bat mkfiles/install.sl --destdir="X-$(DESTDIR)" --prefix="$(PREFIX)" install
43#
44.PHONY: all install clean
45