# Make file for Scintilla and Tide, Windows version
# Copyright 1998-1999 by Neil Hodgson <neilh@hare.net.au>
# The License.txt file describes the conditions under which this software may be distributionributed.
# This makefile assumes the mingw32 version of EGCS 1.1.1 is used and changes will
# be needed to use other compilers.

CC      = g++
DLLWRAP = dllwrap
O		= o
PROG	= Tide.EXE
PROGSTATIC = Tidy.EXE
COMPONENT = Scintilla.DLL
LDFLAGS = -lkernel32 -lgdi32 -luser32 -lwinmm -lcomdlg32 -lcomctl32
#CPPFLAGS = -W -Wall
CPPFLAGS = -Os -fno-exceptions

OBJS	= Tide.$(O) KeyWords.$(O) PropSet.$(O) TideRes.$(O)

ALL:	$(PROG) $(COMPONENT)

$(PROG): $(OBJS)
	$(CC) "-Wl,--subsystem windows,-s" -o $(PROG) $(OBJS) $(LDFLAGS)

Tide.$(O): Tide.h KeyWords.h PropSet.h Scintilla.h Document.h
KeyWords.$(O):	KeyWords.h Scintilla.h
PropSet.$(O):	PropSet.h 
TideRes.$(O):	Tide.h

SOBJS	= Scintilla.$(O) Document.$(O) CallTip.$(O) ScintRes.$(O)
$(COMPONENT): $(SOBJS)
	$(DLLWRAP) --target i386-mingw32  -o $(COMPONENT) $(SOBJS) $(LDFLAGS) -s --relocatable
	
Scintilla.$(O): Scintilla.h Document.h CallTip.h
Document.$(O): Document.h
CallTip.$(O): Scintilla.h CallTip.h
ScintRes.$(O):	Tide.h

OBJSSTATIC = Tidy.$(O) KeyWords.$(O) PropSet.$(O) ScintillaS.$(O) Document.$(O) CallTip.$(O) TideRes.$(O)

$(PROGSTATIC): $(OBJSSTATIC)
	$(CC) "-Wl,--subsystem windows,-s" -o $(PROGSTATIC) $(OBJSSTATIC) $(LDFLAGS)

Tidy.$(O): Tide.cc Tide.h KeyWords.h PropSet.h Scintilla.h Document.h
	g++ $(CPPFLAGS) -c -D STATIC_BUILD Tide.cc -o Tidy.o

ScintillaS.$(O): Scintilla.cc Scintilla.h Document.h CallTip.h
	g++ $(CPPFLAGS) -c -D STATIC_BUILD Scintilla.cc -o ScintillaS.o
	
TideRes.o:	TideRes.rc
	windres TideRes.rc TideRes.o

ScintRes.o:	ScintRes.rc
	windres ScintRes.rc ScintRes.o

use:
	copy Tide.exe C:\TRun\TideRun.exe
	copy Scintilla.dll C:\TRun\Scintilla.dll
	copy TideGlobal.properties C:\TRun\TideGlobal.properties

floppy:
	strip Tide.exe
	strip Scintilla.dll
	copy Tide.exe b:
	copy Scintilla.dll b:
	copy TideGlobal.properties b:

dist:
	-del distribution
	md distribution
	copy Tide.exe distribution
	copy Scintilla.dll distribution
	copy TideGlobal.properties distribution
	copy License.txt distribution
	copy *.cc distribution
	copy *.h distribution
	copy *.rc distribution
	copy *.ico distribution
	copy *.html distribution
	copy *.png distribution
	copy makefile distribution
	copy makefile_vc distribution
	copy Demo.pyro distribution
