aboutsummaryrefslogtreecommitdiffhomepage
path: root/macosx/makefile
blob: 8f4bdf2a8c9523ee3b09b167a118f07e0b1148a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# Make file for Scintilla on Mac OS X
# Copyright 2002 by Evan Jones <ejones@uwaterloo.ca>
# Based on the GTK makefile 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 that Apple's version of 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.

.SUFFIXES: .cxx .c .o .h .a
CC = g++
CCOMP = gcc
LIBTOOL = libtool

GCC_MAJOR    := $(shell $(CC) -v 2>&1 | \
                        grep version | cut -d' ' -f3  | cut -d'.' -f1)

# We call it "libscintilla" so when you add it to a Project Builder project,
# Project Builder will link it correctly.
STATICLIB=../bin/libscintilla.a
DYNAMICLIB=../bin/libscintilla.dylib

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

INCLUDEDIRS=-I ../include -I ../src -I ../lexlib

ifeq ($(GCC_MAJOR),3)
# 10.4 will have GCC 4 or better, so this should only ever happen
# on a 10.3 or older PPC box
ARCHFLAGS=-arch ppc -faltivec -mcpu=7400 -mtune=7400 -mpowerpc -mpowerpc-gfxopt
else
ifndef NATIVE
ARCH_BASE_FLAGS=/Developer/SDKs/MacOSX10.6.sdk -arch i386
ARCHFLAGS=-isysroot $(ARCH_BASE_FLAGS)
LINK_FLAGS=-Wl,-syslibroot,$(ARCH_BASE_FLAGS)
DYN_FLAGS=$(LINK_FLAGS) -framework Carbon -bundle
endif
endif

OPTIONS=-Wall -Wno-missing-braces -Wno-char-subscripts -DSCI_NAMESPACE -DMACOSX -DSCI_LEXER

#DEBUG = 1

ifdef DEBUG
DFLAGS=-DDEBUG -g
else
DFLAGS=-DNDEBUG -Os
endif

ifdef CONTAINER_HANDLES_EVENTS
CONTAINER=-DCONTAINER_HANDLES_EVENTS=1
endif

ifdef EXT_INPUT
EXT_INPUT=-DEXT_INPUT
EXTOBS=ExtInput.o
endif

.cxx.o:
	$(CC) $(CXXFLAGS) $(OPTIONS) $(DFLAGS) $(CONTAINER) $(ARCHFLAGS) $(EXT_INPUT) $(INCLUDEDIRS) -c $<
.c.o:
	$(CCOMP) $(CXXFLAGS) $(OPTIONS) $(DFLAGS) $(CONTAINER) $(ARCHFLAGS) $(EXT_INPUT) $(INCLUDEDIRS) -w -c $<

LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))

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

all: $(STATICLIB) $(LEXOBJS)

shared: $(DYNAMICLIB) $(LEXOBJS)

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

deps:
	$(CC) -MM -DSCI_NAMESPACE -DMACOSX -DSCI_LEXER  $(CXXFLAGS) $(INCLUDEDIRS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../src/*.cxx >deps.mak

COMPLIB=Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \
	CharClassify.o Decoration.o Document.o PerLine.o Catalogue.o CallTip.o \
	ScintillaBase.o ContractionState.o Editor.o ExternalLexer.o PropSetSimple.o PlatMacOSX.o \
	KeyMap.o LineMarker.o PositionCache.o ScintillaMacOSX.o CellBuffer.o ViewStyle.o \
	RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
        TCarbonEvent.o TView.o ScintillaCallTip.o $(EXTOBS) \
	$(LEXOBJS)

$(STATICLIB): $(COMPLIB)
	$(LIBTOOL) -static -o $@ $^

$(DYNAMICLIB): $(COMPLIB)
	$(CC) -dynamic -o $@ $(DYN_FLAGS) $^

# Generate header files from Scintilla.iface
../include/Scintilla_gen.h: ../include/HFacer.py ../include/Face.py ../include/Scintilla.iface
	cd ../include && python HFacer.py
../include/SciLexer_gen.h: ../include/HFacer.py ../include/Face.py ../include/Scintilla.iface
	cd ../include && python HFacer.py
../include/Scintilla.h: ../include/Scintilla_gen.h
../include/SciLexer.h: ../include/SciLexer_gen.h

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