1# ************************************************************* -*- Makefile -*-
2#
3# Copyright (C) 2004-2015 Andreas Huggel <ahuggel@gmx.net>
4#
5# This Makefile is part of the Exiv2 distribution.
6#
7# Redistribution and use in source and binary forms, with or without
8# modification, are permitted provided that the following conditions
9# are met:
10#
11#    1. Redistributions of source code must retain the above copyright
12#       notice, this list of conditions and the following disclaimer.
13#    2. Redistributions in binary form must reproduce the above
14#       copyright notice, this list of conditions and the following
15#       disclaimer in the documentation and/or other materials provided
16#       with the distribution.
17#    3. The name of the author may not be used to endorse or promote
18#       products derived from this software without specific prior
19#       written permission.
20#
21# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
25# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
27# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
29# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
31# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32#
33# File:      Makefile
34# Version:   $Rev: 3777 $
35# Author(s): Andreas Huggel (ahu) <ahuggel@gmx.net>
36# History:   30-Sep-07, ahu: created
37#
38# Description:
39#  Makefile to build the Adobe XMP Toolkit integrated and distributed with
40#  Exiv2. Adapted from the main Exiv2 src/Makefile. This builds what the
41#  libtool manual calls a "convenience library".
42#
43# Restrictions:
44#  Requires GNU make.
45#
46
47# Default make target
48all: xmpsdk
49
50# Include system configuration
51top_srcdir = ../..
52include $(top_srcdir)/config/config.mk
53
54# ******************************************************************************
55# Source files
56
57# Add library C++ source files to this list
58CCSRC = XML_Node.cpp           \
59        XMPMeta.cpp            \
60        XMPMeta-GetSet.cpp     \
61        XMPMeta-Parse.cpp      \
62        XMPMeta-Serialize.cpp  \
63        XMPIterator.cpp        \
64        XMPUtils.cpp           \
65        XMPUtils-FileInfo.cpp  \
66        XMPCore_Impl.cpp       \
67        ExpatAdapter.cpp       \
68        ParseRDF.cpp           \
69        UnicodeConversions.cpp \
70        MD5.cpp                \
71        WXMPMeta.cpp           \
72        WXMPIterator.cpp       \
73        WXMPUtils.cpp
74
75# ******************************************************************************
76# Library
77LIBRARY := lib$(XMPSDK_LIBRARY).la
78
79# ******************************************************************************
80# Initialisations
81SHELL = /bin/sh
82
83.SUFFIXES:
84.SUFFIXES: .c .cpp .o .so
85
86.PRECIOUS: %.cpp
87
88# For a debug build, replace -DNDEBUG=1 with -DDEBUG=1 -D_DEBUG=1
89CPPFLAGS += -I../include -funsigned-char -DNDEBUG=1 $(EXPAT_CPPFLAGS)
90ifdef HAVE_STDINT
91	CPPFLAGS += -DEXV_HAVE_STDINT_H=1
92endif
93
94LDFLAGS += $(EXPAT_LDFLAGS)
95LIBS += $(EXPAT_LIBS)
96
97# Generic variables
98CCOBJ = $(CCSRC:.cpp=.o)
99LOBJ = $(CCSRC:.cpp=.lo)
100
101ifdef DEP_TRACKING
102DEP = $(CCSRC:%.cpp=$(DEPDIR)/%.d)
103endif
104
105# ******************************************************************************
106# Rules
107$(CCOBJ): %.o: %.cpp
108	@$(LIBTOOL) --mode=compile $(COMPILE.cc) -o $@ $<
109	@$(MAKEDEPEND)
110	@$(POSTDEPEND)
111
112%.ii: %.cpp
113	set -e; \
114	$(CXXCPP) $(CPPFLAGS) $< | sed '/^[ 	]*$$/d' > $@
115
116# ******************************************************************************
117# Targets
118.PHONY: all mostlyclean clean distclean maintainer-clean
119
120ifdef DEP_TRACKING
121# Include targets from dependency files
122-include $(DEP)
123endif
124
125$(LIBTOOL): $(LIBTOOL_DEPS)
126	$(SHELL) $(top_srcdir)/config.status --recheck
127
128xmpsdk: $(LIBRARY)
129
130$(LIBRARY): $(CCOBJ)
131	$(LIBTOOL) --mode=link $(LINK.cc) -o $(LIBRARY) $(LOBJ)
132
133mostlyclean:
134	$(RM) core
135	$(RM) $(CCSRC:.cpp=.ii)
136	$(RM) $(CCSRC:%.cpp=.libs/%.d)
137	@$(LIBTOOL) --mode=clean $(RM) $(LOBJ)
138
139clean: mostlyclean
140	@$(LIBTOOL) --mode=clean $(RM) $(LIBRARY)
141
142# Run `make distclean' from the top source directory to also remove
143# files created by configuring the program.
144distclean: clean
145ifdef DEP_TRACKING
146	$(RM) $(DEP)
147	-rmdir $(DEPDIR)
148endif
149	$(RM) *~ *.bak *#
150
151# This command is intended for maintainers to use; it deletes files
152# that may need special tools to rebuild.
153maintainer-clean: distclean
154