# Make file for Scintilla on Linux or compatible OS
# Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
# ---------------------------------------------------------
# Modified by Iago Rubio for cssed  -  Tue Dec 23 13:13:21 2003    
# Get the original makefile for scintilla from http://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 .o .h .a
CC = g++
AR = ar
RANLIB = touch

ifeq ($(OSTYPE),darwin)
CC = c++
AR = ar
RANLIB = ranlib
endif

COMPLIB=../bin/scintilla.a

vpath %.h ../src ../include
vpath %.cxx ../src

INCLUDEDIRS=-I ../include -I ../src
CXXBASEFLAGS=-W -Wall -DGTK -DSCI_LEXER $(INCLUDEDIRS)

ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE
else
THREADFLAGS=
endif

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

CONFIGFLAGS=pkg-config --cflags gtk+-2.0

.cxx.o:
	$(CC) `$(CONFIGFLAGS)` $(CXXFLAGS) -c $<

#++Autogenerated -- run src/LexGen.py to regenerate
#**LEXOBJS=\\\n\(\*.o \)
LEXOBJS=\
LexOthers.o LexCSS.o LexHTML.o 
#--Autogenerated -- end of automatically generated section

# The LEXOBJS have to be treated specially as the functions in them are not called from external code

all: $(COMPLIB) $(LEXOBJS)

clean:
	rm -f *.o $(COMPLIB)

deps:
	$(CC) -MM  `$(CONFIGFLAGS)` *.cxx ../src/*.cxx >deps.mak

$(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 XPM.o
	$(AR) rc $@ $^
	$(RANLIB) $@

# Automatically generate header dependencies with "make deps"
include deps.mak
