summaryrefslogtreecommitdiff
blob: f5f01eac71aa5e7a21870718bd12890696c943ca (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
Use pkg-config for xerces-c
Respect CXX and CC
Replace CFLAGS with CXXFLAGS where needed
Add LDFLAGS

--- a/makefile
+++ b/makefile
@@ -93,35 +93,40 @@
 
 $(BINDIR_XMLIN)/InputSymbolTranslation.o: InputSymbolTranslation.cpp InputSymbolTranslation.inc
 
-CFLAGS = -O2
+PKG_CONFIG ?= pkg-config
+CFLAGS ?= -O2
 
 VPATH = Source:Source/BlahtexCore:Source/BlahtexXMLin
 
 INCLUDES=-I. -ISource -ISource/BlahtexCore -ISource/BlahtexXMLin
 
+CXXFLAGS += $(shell $(PKG_CONFIG) --cflags xerces-c)
+
+XERCES_LIB = $(shell $(PKG_CONFIG) --libs xerces-c)
+
 $(BINDIR)/%.o:%.cpp
-	$(CXX) $(INCLUDES) $(CFLAGS) -c $< -o $@
+	$(CXX) $(INCLUDES) $(CXXFLAGS) -c $< -o $@
 
 $(BINDIR)/%.o:%.c
 	$(CC) $(INCLUDES) $(CFLAGS) -c $< -o $@
 
 $(BINDIR_XMLIN)/%.o:%.cpp
-	$(CXX) $(INCLUDES) $(CFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
+	$(CXX) $(INCLUDES) $(CXXFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
 
 $(BINDIR_XMLIN)/%.o:%.c
 	$(CC) $(INCLUDES) $(CFLAGS) -DBLAHTEXML_USING_XERCES -c $< -o $@
 
 blahtex-linux:  $(BINDIR) $(OBJECTS)  $(HEADERS)
-	$(CXX) $(CFLAGS) -o blahtex $(OBJECTS)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o blahtex $(OBJECTS) $(LIBS)
 
 blahtex-mac: $(BINDIR) $(OBJECTS)  $(HEADERS)
-	$(CXX) $(CFLAGS) -o blahtex -liconv $(OBJECTS)
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o blahtex -liconv $(OBJECTS) $(LIBS)
 
 blahtexml-linux:  $(BINDIR_XMLIN) $(OBJECTS_XMLIN)  $(HEADERS_XMLIN)
-	$(CXX) $(CFLAGS) -o blahtexml $(OBJECTS_XMLIN) -lxerces-c
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o blahtexml $(OBJECTS_XMLIN) $(LIBS) $(XERCES_LIB)
 
 blahtexml-mac: $(BINDIR_XMLIN) $(OBJECTS_XMLIN)  $(HEADERS_XMLIN)
-	$(CXX) $(CFLAGS) -o blahtexml -liconv $(OBJECTS_XMLIN) -lxerces-c
+	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o blahtexml -liconv $(OBJECTS_XMLIN) $(LIBS) $(XERCES_LIB)
 
 clean:
 	rm -f blahtex $(OBJECTS) blahtexml $(OBJECTS_XMLIN)