# Make file for Scintilla on Linux or compatible OS
# Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
# The License.txt file describes the conditions under which this software may be distributed.
# This makefile assumes GCC 3.1 is used and changes will be needed to use other compilers.
# GNU make does not like \r\n line endings so should be saved to CVS in binary form.
# Builds for GTK+ 2 if available else GTK+ 1.
# To force GTK+ 2 build, define GTK2 on the make command line.
# To force GTK+ 1 build, define GTK1 on the make command line.

.SUFFIXES: .cxx .c .o .h .a
CC = g++
CCOMP = gcc
AR = ar
RANLIB = ranlib
PREFIX = C:\libs
RM = del
-include ../localwin32.mk


COMPLIB=scintilla.a

GTK_INCLUDES= \
	-I$(PREFIX)/include/gtk-2.0 \
	-I$(PREFIX)/lib/gtk-2.0/include \
	-I$(PREFIX)/include/atk-1.0 \
	-I$(PREFIX)/include/pango-1.0 \
	-I$(PREFIX)/include/cairo \
	-I$(PREFIX)/include/glib-2.0 \
	-I$(PREFIX)/lib/glib-2.0/include \
	-I$(PREFIX)/include/gettext \
	-I$(PREFIX)/include


vpath %.h . include
vpath %.cxx .

INCLUDEDIRS=-I include -I . $(GTK_INCLUDES)
CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -DGTK -DGTK2 -DSCI_LEXER $(INCLUDEDIRS) -mms-bitfields

ifdef THREADS
THREADFLAGS=
else
THREADFLAGS=-DG_THREADS_IMPL_NONE
endif

ifdef DEBUG
CXXFLAGS=-DDEBUG -g -O0 $(CXXBASEFLAGS) $(THREADFLAGS)
else
CXXFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
endif

CONFIGFLAGS=$(GTK_INCLUDES)
MARSHALLER=scintilla-marshal.o

.cxx.o:
	$(CC) $(CXXFLAGS) -c $<
.c.o:
	$(CCOMP) $(CXXFLAGS) -w -c $<

#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\*.o \)
LEXOBJS=\
LexBash.o LexAsm.o LexCSS.o LexCPP.o LexCrontab.o LexHTML.o LexOthers.o LexPascal.o \
LexPerl.o LexPython.o LexSQL.o LexCaml.o LexOMS.o LexTCL.o LexRuby.o LexFortran.o LexVHDL.o \
LexD.o LexLua.o LexHaskell.o LexBasic.o LexR.o
#--Autogenerated -- end of automatically generated section

all: $(COMPLIB)

clean:
	-$(RM) deps.mak *.o $(COMPLIB)

$(COMPLIB): DocumentAccessor.o WindowAccessor.o KeyWords.o StyleContext.o Document.o CallTip.o \
	ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSet.o PlatGTK.o \
	KeyMap.o LineMarker.o ScintillaGTK.o CellBuffer.o ViewStyle.o \
	RESearch.o Style.o Indicator.o AutoComplete.o UniConversion.o CharClassify.o XPM.o \
	RunStyles.o Decoration.o PositionCache.o \
	$(MARSHALLER) $(LEXOBJS)
	$(AR) rc $@ $^
	$(RANLIB) $@

deps.mak:
	$(CC) -MM  $(CXXFLAGS) *.cxx >deps.mak

# Generate header dependencies with "make deps.mak"
include deps.mak