summaryrefslogtreecommitdiff
blob: 9e480922e9f0254f3153a56f65d8ac33cfc0e4a3 (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
AR ?= ar
CXX ?= g++
CXXFLAGS += -Wall
RANLIB ?= ranlib

name = libtinyxml
major = @MAJOR_V@
minor = @MINOR_V@
version = $(major).$(minor)

src = tinyxml.cpp tinyxmlparser.cpp tinyxmlerror.cpp tinystr.cpp
lo = $(addsuffix .lo,$(basename ${src}))
o = $(addsuffix .o,$(basename ${src}))

all: $(name).a $(name).so

%.o: %.cpp
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) $< -o $@

$(name).a: $(o)
	$(AR) rc $(name).a $(o)
	$(RANLIB) $(name).a

%.lo: %.cpp
	$(CXX) -c $(CXXFLAGS) $(CPPFLAGS) -fPIC $< -o $@

$(name).so: $(lo)
	$(CXX) $(LDFLAGS) -fPIC -shared $(lo) -Wl,-soname,$(name).so.$(major) -o $(name).so.$(version)
	ln -s $(name).so.$(version) $(name).so.$(major)
	ln -s $(name).so.$(version) $(name).so

clean:
	-rm -f *.o *.lo *.so* *.a