From a6440d4ed1861d373a9c56b69a6998fb7cf76727 Mon Sep 17 00:00:00 2001 From: Andreas Huggel Date: Mon, 8 Oct 2007 09:17:20 +0000 Subject: [PATCH] Moved sample programs into new samples/ directory. Cleaned-up the makefiles and applied BSD license to all makefiles. --- Makefile | 42 +++++++- config/Doxyfile | 2 +- config/Makefile.in | 42 +++++++- config/config.make | 32 +++++- config/config.mk.in | 77 +++++++++++---- config/configure.ac | 4 +- doc/Makefile | 30 ++++++ doc/templates/Makefile | 39 +++++++- samples/Makefile | 146 ++++++++++++++++++++++++++++ {src => samples}/addmoddel.cpp | 4 +- {src => samples}/crwedit.cpp | 4 +- {src => samples}/crwparse.cpp | 4 +- {src => samples}/dataarea-test.cpp | 6 +- {src => samples}/exifcomment.cpp | 4 +- {src => samples}/exifdata-test.cpp | 4 +- {src => samples}/exifprint.cpp | 4 +- {src => samples}/ifd-test.cpp | 4 +- {src => samples}/iotest.cpp | 8 +- {src => samples}/iptceasy.cpp | 4 +- {src => samples}/iptcprint.cpp | 4 +- {src => samples}/iptctest.cpp | 8 +- {src => samples}/key-test.cpp | 4 +- {src => samples}/largeiptc-test.cpp | 8 +- {src => samples}/makernote-test.cpp | 2 +- {src => samples}/taglist.cpp | 11 +-- {src => samples}/tiffparse.cpp | 10 +- {src => samples}/write-test.cpp | 6 +- {src => samples}/write2-test.cpp | 4 +- {src => samples}/xmpparse.cpp | 6 +- {src => samples}/xmpparser-test.cpp | 8 +- {src => samples}/xmpsample.cpp | 4 +- src/Makefile | 104 +++++++------------- test/Makefile | 42 ++++++++ test/addmoddel.sh | 7 +- test/bugfixes-test.sh | 47 +++++---- test/crw-test.sh | 17 ++-- test/data/exiv2-test.out | 2 +- test/exifdata-test.sh | 4 +- test/exiv2-test.sh | 6 +- test/ifd-test.sh | 4 +- test/iotest.sh | 4 +- test/iptctest.sh | 4 +- test/makernote-test.sh | 4 +- test/modify-test.sh | 10 +- test/write-test.sh | 4 +- test/write2-test.sh | 4 +- test/xmpparser-test.sh | 6 +- xmpsdk/README | 9 +- xmpsdk/src/Makefile | 62 +++++++++--- 49 files changed, 616 insertions(+), 259 deletions(-) create mode 100644 samples/Makefile rename {src => samples}/addmoddel.cpp (98%) rename {src => samples}/crwedit.cpp (98%) rename {src => samples}/crwparse.cpp (95%) rename {src => samples}/dataarea-test.cpp (98%) rename {src => samples}/exifcomment.cpp (97%) rename {src => samples}/exifdata-test.cpp (98%) rename {src => samples}/exifprint.cpp (96%) rename {src => samples}/ifd-test.cpp (99%) rename {src => samples}/iotest.cpp (98%) rename {src => samples}/iptceasy.cpp (96%) rename {src => samples}/iptcprint.cpp (96%) rename {src => samples}/iptctest.cpp (97%) rename {src => samples}/key-test.cpp (99%) rename {src => samples}/largeiptc-test.cpp (95%) rename {src => samples}/makernote-test.cpp (97%) rename {src => samples}/taglist.cpp (91%) rename {src => samples}/tiffparse.cpp (91%) rename {src => samples}/write-test.cpp (98%) rename {src => samples}/write2-test.cpp (99%) rename {src => samples}/xmpparse.cpp (95%) rename {src => samples}/xmpparser-test.cpp (95%) rename {src => samples}/xmpsample.cpp (99%) diff --git a/Makefile b/Makefile index 446d9cc9..eb02072a 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,36 @@ # ***************************************************** -*- Makefile -*- # -# File: Makefile +# Copyright (C) 2004-2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# File: Makefile.in # Version: $Rev$ # Author(s): Andreas Huggel (ahu) # History: 15-Jan-04, ahu: created @@ -14,15 +44,15 @@ # ######################################################################## -# This is a generated file. Do NOT change any settings here. -# Run ./configure with the appropriate options to regenerate this file +# Makefile is a generated file. Do NOT change any settings in this file. +# Run ./configure with the appropriate options to regenerate the file # and possibly others. ######################################################################## SHELL = /bin/sh ENABLE_XMP = 1 -.PHONY: all doc config xmpsdk \ +.PHONY: all doc config samples xmpsdk \ mostlyclean clean distclean maintainer-clean \ install uninstall @@ -37,6 +67,9 @@ uninstall: config/config.mk doc: config/config.mk cd doc && $(MAKE) $(MAKECMDGOALS) +samples: config/config.mk + cd samples && $(MAKE) $(MAKECMDGOALS) + config: cd config && $(MAKE) -f config.make $(MAKECMDGOALS) @@ -46,6 +79,7 @@ xmpsdk: config/config.mk mostlyclean clean: config/config.mk cd src && $(MAKE) $(MAKECMDGOALS) cd doc && $(MAKE) $(MAKECMDGOALS) + cd samples && $(MAKE) $(MAKECMDGOALS) cd xmpsdk/src && $(MAKE) $(MAKECMDGOALS) cd config && $(MAKE) -f config.make $(MAKECMDGOALS) cd po && $(MAKE) $(MAKECMDGOALS) diff --git a/config/Doxyfile b/config/Doxyfile index ee0bc399..aabbe96c 100644 --- a/config/Doxyfile +++ b/config/Doxyfile @@ -522,7 +522,7 @@ EXCLUDE_SYMBOLS = # directories that contain example code fragments that are included (see # the \include command). -EXAMPLE_PATH = ../src/ +EXAMPLE_PATH = ../samples/ # If the value of the EXAMPLE_PATH tag contains directories, you can use the # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp diff --git a/config/Makefile.in b/config/Makefile.in index ac704296..13fbd299 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -1,6 +1,36 @@ # ***************************************************** -*- Makefile -*- # -# File: Makefile +# Copyright (C) 2004-2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# File: Makefile.in # Version: $Rev$ # Author(s): Andreas Huggel (ahu) # History: 15-Jan-04, ahu: created @@ -14,15 +44,15 @@ # ######################################################################## -# This is a generated file. Do NOT change any settings here. -# Run ./configure with the appropriate options to regenerate this file +# Makefile is a generated file. Do NOT change any settings in this file. +# Run ./configure with the appropriate options to regenerate the file # and possibly others. ######################################################################## SHELL = /bin/sh ENABLE_XMP = @ENABLE_XMP@ -.PHONY: all doc config xmpsdk \ +.PHONY: all doc config samples xmpsdk \ mostlyclean clean distclean maintainer-clean \ install uninstall @@ -37,6 +67,9 @@ uninstall: config/config.mk doc: config/config.mk cd doc && $(MAKE) $(MAKECMDGOALS) +samples: config/config.mk + cd samples && $(MAKE) $(MAKECMDGOALS) + config: cd config && $(MAKE) -f config.make $(MAKECMDGOALS) @@ -46,6 +79,7 @@ xmpsdk: config/config.mk mostlyclean clean: config/config.mk cd src && $(MAKE) $(MAKECMDGOALS) cd doc && $(MAKE) $(MAKECMDGOALS) + cd samples && $(MAKE) $(MAKECMDGOALS) cd xmpsdk/src && $(MAKE) $(MAKECMDGOALS) cd config && $(MAKE) -f config.make $(MAKECMDGOALS) cd po && $(MAKE) $(MAKECMDGOALS) diff --git a/config/config.make b/config/config.make index d47b75cf..7a1dccbf 100644 --- a/config/config.make +++ b/config/config.make @@ -1,6 +1,36 @@ # ***************************************************** -*- Makefile -*- # -# File: Makefile +# Copyright (C) 2005-2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# File: config.make # Version: $Rev$ # Author(s): Andreas Huggel (ahu) # History: 26-Feb-05, ahu: created diff --git a/config/config.mk.in b/config/config.mk.in index 713f7197..228e3f40 100644 --- a/config/config.mk.in +++ b/config/config.mk.in @@ -4,19 +4,31 @@ # # This Makefile is part of the Exiv2 distribution. # -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # File: config.mk.in # Version: $Rev$ @@ -80,16 +92,17 @@ endif ENABLE_XMP = @ENABLE_XMP@ ifdef ENABLE_XMP - XMPSDK_DIR = $(top_srcdir)/xmpsdk - XMPSDK_CPPFLAGS = -DUNIX_ENV -I$(XMPSDK_DIR)/include - XMPSDK_LDFLAGS = -L$(XMPSDK_DIR)/lib - XMPSDK_LIBS = -lxmpsdk + XMPSDK_LIBRARY = xmpsdk + XMPSDK_DIR = $(top_srcdir)/xmpsdk + XMPSDK_CPPFLAGS = -DUNIX_ENV -I$(XMPSDK_DIR)/include + XMPSDK_LDFLAGS = -L$(XMPSDK_DIR)/lib + XMPSDK_LIBS = -l$(XMPSDK_LIBRARY) else # Enable additional warnings. XMP Toolkit doesn't compile # with these. - ifeq ($(GXX),yes) - CXXFLAGS += -Wundef -pedantic - endif + ifeq ($(GXX),yes) + CXXFLAGS += -Wundef -pedantic + endif endif # Expat library needed to compile the XMP Toolkit @@ -108,13 +121,39 @@ HAVE_TIMEGM = @HAVE_TIMEGM@ DEP_TRACKING = @DEP_TRACKING@ ifdef DEP_TRACKING + # Directory for dependency files + DEPDIR = .deps + # Command to run the compiler or preprocessor to produce # dependencies. If you're not using gcc, you may need to change # this to something suitable for your compiler or simply unset # the variable. See the link above for suggestions. MAKEDEPEND = $(CXX) -MM $(CPPFLAGS) -o $*.d $< + + # Dependency files post-process commands + POSTDEPEND = if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi; \ + if test -e $*.d; then cp $*.d $(DEPDIR)/$*.d; \ + sed -e 's/^\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ + -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(DEPDIR)/$*.d; \ + $(RM) $*.d; fi + + # Compiler flags to generate dependency files at the same time + # as object files (for gcc) + ifeq ($(GXX),yes) + CXXFLAGS += -MMD + CFLAGS += -MMD + MAKEDEPEND = + endif endif +# ********************************************************************** +# Compilation shortcuts +COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c +COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c +# LINK.cc does not need $(LIBS), libtool's dark magic takes care of that +# when linking a binary with a libtool library. +LINK.cc = $(CXX) $(CXXFLAGS) $(LDFLAGS) + # ********************************************************************** # Installation programs INSTALL_EXE = @INSTALL@ diff --git a/config/configure.ac b/config/configure.ac index dbd9a1d0..d2431cc8 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -201,7 +201,9 @@ AC_OUTPUT # --------------------------------------------------------------------------- echo "" -echo "-- Exiv2 feature configuration summary ---------------------------" +echo "------------------------------------------------------------------" +echo "-- Exiv2 $VERSION feature configuration summary" +echo "--" case "$enable_shared" in yes) echo "-- Build a shared library......... YES" ;; diff --git a/doc/Makefile b/doc/Makefile index 3a80fd21..b7b5ed48 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,5 +1,35 @@ # ***************************************************** -*- Makefile -*- # +# Copyright (C) 2004-2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# # File: Makefile # Version: $Rev$ # Author(s): Andreas Huggel (ahu) diff --git a/doc/templates/Makefile b/doc/templates/Makefile index b8cb10b4..2da39629 100644 --- a/doc/templates/Makefile +++ b/doc/templates/Makefile @@ -1,14 +1,45 @@ # ************************************************************* -*- Makefile -*- # +# Copyright (C) 2004-2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# # File: Makefile # Version: $Rev$ # Author(s): Andreas Huggel (ahu) # History: 28-May-05, ahu: created # # Description: -# Simple Makefile to create html documentation from templates. Requires some -# special tools (awk, python, xsltproc) but really only needs to be used to -# update the documentation after changing Exiv2 tags in the source code. +# Simple Makefile to create html documentation from templates. Requires +# some special tools (awk, python, xsltproc) but really only needs to +# be used to update the documentation after changing Exiv2 tags in the +# source code. # # Restrictions: # Only tested with GNU make. @@ -18,7 +49,7 @@ TABLES = Exif Canon CanonCs CanonSi CanonCf CanonPi CanonPa Fujifilm Minolta \ MinoltaCsNew MinoltaCs5D MinoltaCs7D Nikon1 Nikon2 Nikon3 Olympus \ Panasonic Sigma Sony -TAGLIST = ../../src/taglist +TAGLIST = ../../samples/taglist # ********************************************************************** # ====================================================================== diff --git a/samples/Makefile b/samples/Makefile new file mode 100644 index 00000000..fd456231 --- /dev/null +++ b/samples/Makefile @@ -0,0 +1,146 @@ +# ************************************************************* -*- Makefile -*- +# +# Copyright (C) 2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# File: Makefile +# Version: $Rev$ +# Author(s): Andreas Huggel (ahu) +# History: 08-Oct-07, ahu: created +# +# Description: +# Simple Makefile to build sample programs. Requires installed exiv2 library +# and headers. Adapted from the main Exiv2 src/Makefile. +# +# Restrictions: +# Requires GNU make. +# + +# Default make target +all: samples + +# Include system configuration +top_srcdir = .. +include $(top_srcdir)/config/config.mk + +# ****************************************************************************** +# Source files + +# Add source files of sample programs to this list +BINSRC = addmoddel.cpp \ + crwedit.cpp \ + crwparse.cpp \ + dataarea-test.cpp \ + exifcomment.cpp \ + exifdata-test.cpp \ + exifprint.cpp \ + ifd-test.cpp \ + iotest.cpp \ + iptceasy.cpp \ + iptcprint.cpp \ + iptctest.cpp \ + key-test.cpp \ + largeiptc-test.cpp \ + makernote-test.cpp \ + taglist.cpp \ + write-test.cpp \ + write2-test.cpp \ + tiffparse.cpp \ + xmpparse.cpp \ + xmpparser-test.cpp \ + xmpsample.cpp + +# ****************************************************************************** +# Initialisations +SHELL = /bin/sh + +.SUFFIXES: +.SUFFIXES: .c .cpp .o .so + +.PRECIOUS: %.cpp + +CPPFLAGS := `pkg-config exiv2 --cflags` +LDFLAGS := `pkg-config exiv2 --libs` + +BINOBJ = $(BINSRC:.cpp=.o) +BINARY = $(BINSRC:.cpp=) +EXECUTABLE = $(BINSRC:.cpp=$(EXEEXT)) + +ifdef DEP_TRACKING +DEP = $(BINSRC:%.cpp=$(DEPDIR)/%.d) +endif + +# ****************************************************************************** +# Rules +samples: $(BINARY) + +$(BINOBJ): %.o: %.cpp + $(COMPILE.cc) -o $@ $< + @$(MAKEDEPEND) + @$(POSTDEPEND) + +$(BINARY): %: %.o + $(LIBTOOL) --mode=link $(LINK.cc) -o $@ $@.o + +%.ii: %.cpp + set -e; \ + $(CXXCPP) -E $(CPPFLAGS) $< | sed '/^[ ]*$$/d' > $@ + +# ****************************************************************************** +# Targets +.PHONY: all mostlyclean clean distclean maintainer-clean + +ifdef DEP_TRACKING +# Include targets from dependency files +-include $(DEP) +endif + +mostlyclean: + $(RM) core + $(RM) $(CCSRC:.cpp=.ii) + $(RM) $(CCSRC:%.cpp=.libs/%.d) $(CSRC:%.c=.libs/%.d) + -rmdir .libs + $(RM) $(BINOBJ) + +clean: mostlyclean + $(RM) $(EXECUTABLE) + +# Run `make distclean' from the top source directory to also remove +# files created by configuring the program. +distclean: clean +ifdef DEP_TRACKING + $(RM) $(DEP) + -rmdir $(DEPDIR) +endif + $(RM) *~ *.bak *# + +# This command is intended for maintainers to use; it deletes files +# that may need special tools to rebuild. +maintainer-clean: distclean diff --git a/src/addmoddel.cpp b/samples/addmoddel.cpp similarity index 98% rename from src/addmoddel.cpp rename to samples/addmoddel.cpp index 4383e5df..7a5f4237 100644 --- a/src/addmoddel.cpp +++ b/samples/addmoddel.cpp @@ -2,8 +2,8 @@ // addmoddel.cpp, $Rev$ // Sample program showing how to add, modify and delete Exif metadata. -#include "image.hpp" -#include "exif.hpp" +#include +#include #include #include #include diff --git a/src/crwedit.cpp b/samples/crwedit.cpp similarity index 98% rename from src/crwedit.cpp rename to samples/crwedit.cpp index 3a176a37..764e9c79 100644 --- a/src/crwedit.cpp +++ b/samples/crwedit.cpp @@ -2,8 +2,8 @@ // crwedit.cpp, $Rev$ // Print the CIFF structure of a CRW file -#include "crwimage.hpp" -#include "futils.hpp" +#include +#include #include #include diff --git a/src/crwparse.cpp b/samples/crwparse.cpp similarity index 95% rename from src/crwparse.cpp rename to samples/crwparse.cpp index b741a614..e844fe89 100644 --- a/src/crwparse.cpp +++ b/samples/crwparse.cpp @@ -2,8 +2,8 @@ // crwparse.cpp, $Rev$ // Print the CIFF structure of a CRW file -#include "crwimage.hpp" -#include "futils.hpp" +#include +#include #include diff --git a/src/dataarea-test.cpp b/samples/dataarea-test.cpp similarity index 98% rename from src/dataarea-test.cpp rename to samples/dataarea-test.cpp index eab898dc..29fcca2a 100644 --- a/src/dataarea-test.cpp +++ b/samples/dataarea-test.cpp @@ -10,9 +10,9 @@ */ // ***************************************************************************** // included header files -#include "image.hpp" -#include "jpgimage.hpp" -#include "exif.hpp" +#include +#include +#include #include #include #include diff --git a/src/exifcomment.cpp b/samples/exifcomment.cpp similarity index 97% rename from src/exifcomment.cpp rename to samples/exifcomment.cpp index f132246a..22f51b24 100644 --- a/src/exifcomment.cpp +++ b/samples/exifcomment.cpp @@ -11,8 +11,8 @@ */ // ***************************************************************************** // included header files -#include "image.hpp" -#include "exif.hpp" +#include +#include #include #include diff --git a/src/exifdata-test.cpp b/samples/exifdata-test.cpp similarity index 98% rename from src/exifdata-test.cpp rename to samples/exifdata-test.cpp index 2526b519..abb5ec6e 100644 --- a/src/exifdata-test.cpp +++ b/samples/exifdata-test.cpp @@ -10,8 +10,8 @@ */ // ***************************************************************************** // included header files -#include "image.hpp" -#include "exif.hpp" +#include +#include #include #include #include diff --git a/src/exifprint.cpp b/samples/exifprint.cpp similarity index 96% rename from src/exifprint.cpp rename to samples/exifprint.cpp index 7de9c444..1ac4e3f9 100644 --- a/src/exifprint.cpp +++ b/samples/exifprint.cpp @@ -2,8 +2,8 @@ // exifprint.cpp, $Rev$ // Sample program to print the Exif metadata of an image -#include "image.hpp" -#include "exif.hpp" +#include +#include #include #include #include diff --git a/src/ifd-test.cpp b/samples/ifd-test.cpp similarity index 99% rename from src/ifd-test.cpp rename to samples/ifd-test.cpp index 9ac787a8..05070032 100644 --- a/src/ifd-test.cpp +++ b/samples/ifd-test.cpp @@ -9,8 +9,8 @@ */ // ***************************************************************************** // included header files -#include "ifd.hpp" -#include "error.hpp" +#include +#include #include #include diff --git a/src/iotest.cpp b/samples/iotest.cpp similarity index 98% rename from src/iotest.cpp rename to samples/iotest.cpp index 9f17c7b5..a77b3018 100644 --- a/src/iotest.cpp +++ b/samples/iotest.cpp @@ -29,10 +29,10 @@ */ // ***************************************************************************** // included header files -#include "types.hpp" -#include "error.hpp" -#include "futils.hpp" -#include "basicio.hpp" +#include +#include +#include +#include #include #include diff --git a/src/iptceasy.cpp b/samples/iptceasy.cpp similarity index 96% rename from src/iptceasy.cpp rename to samples/iptceasy.cpp index 17aab498..85444833 100644 --- a/src/iptceasy.cpp +++ b/samples/iptceasy.cpp @@ -2,8 +2,8 @@ // iptceasy.cpp, $Rev$ // The quickest way to access, set or modify Iptc metadata. -#include "iptc.hpp" -#include "image.hpp" +#include +#include #include #include #include diff --git a/src/iptcprint.cpp b/samples/iptcprint.cpp similarity index 96% rename from src/iptcprint.cpp rename to samples/iptcprint.cpp index 24b957cd..341aafad 100644 --- a/src/iptcprint.cpp +++ b/samples/iptcprint.cpp @@ -2,8 +2,8 @@ // iptcprint.cpp, $Rev$ // Sample program to print the Iptc metadata of an image -#include "image.hpp" -#include "iptc.hpp" +#include +#include #include #include #include diff --git a/src/iptctest.cpp b/samples/iptctest.cpp similarity index 97% rename from src/iptctest.cpp rename to samples/iptctest.cpp index b611e6c2..ce0c9a9a 100644 --- a/src/iptctest.cpp +++ b/samples/iptctest.cpp @@ -10,10 +10,10 @@ */ // ***************************************************************************** // included header files -#include "image.hpp" -#include "iptc.hpp" -#include "datasets.hpp" -#include "value.hpp" +#include +#include +#include +#include #include #include #include diff --git a/src/key-test.cpp b/samples/key-test.cpp similarity index 99% rename from src/key-test.cpp rename to samples/key-test.cpp index 1a848274..74800e35 100644 --- a/src/key-test.cpp +++ b/samples/key-test.cpp @@ -10,8 +10,8 @@ */ // ***************************************************************************** // included header files -#include "exif.hpp" -#include "iptc.hpp" +#include +#include #include #include diff --git a/src/largeiptc-test.cpp b/samples/largeiptc-test.cpp similarity index 95% rename from src/largeiptc-test.cpp rename to samples/largeiptc-test.cpp index f91f7994..1774d814 100644 --- a/src/largeiptc-test.cpp +++ b/samples/largeiptc-test.cpp @@ -1,10 +1,10 @@ // ***************************************************************** -*- C++ -*- // Test for large (>65535 bytes) IPTC buffer -#include "iptc.hpp" -#include "image.hpp" -#include "jpgimage.hpp" -#include "futils.hpp" +#include +#include +#include +#include #include #include diff --git a/src/makernote-test.cpp b/samples/makernote-test.cpp similarity index 97% rename from src/makernote-test.cpp rename to samples/makernote-test.cpp index 1b69060b..9c2184db 100644 --- a/src/makernote-test.cpp +++ b/samples/makernote-test.cpp @@ -1,4 +1,4 @@ -#include "makernote.hpp" +#include #include #include diff --git a/src/taglist.cpp b/samples/taglist.cpp similarity index 91% rename from src/taglist.cpp rename to samples/taglist.cpp index bd694fa3..93b7fbcb 100644 --- a/src/taglist.cpp +++ b/samples/taglist.cpp @@ -8,13 +8,10 @@ History: 07-Jan-04, ahu: created */ // ***************************************************************************** -#include "rcsid.hpp" -EXIV2_RCSID("@(#) $Id$") - -#include "makernote.hpp" -#include "tags.hpp" -#include "datasets.hpp" -#include "error.hpp" +#include +#include +#include +#include #include #include diff --git a/src/tiffparse.cpp b/samples/tiffparse.cpp similarity index 91% rename from src/tiffparse.cpp rename to samples/tiffparse.cpp index 53d89fe3..16b3d1a1 100644 --- a/src/tiffparse.cpp +++ b/samples/tiffparse.cpp @@ -2,11 +2,11 @@ // tiffparse.cpp, $Rev$ // Print the structure of a TIFF file -#include "tiffparser.hpp" -#include "tiffcomposite.hpp" -#include "tiffvisitor.hpp" -#include "tiffimage.hpp" -#include "futils.hpp" +#include +#include +#include +#include +#include #include diff --git a/src/write-test.cpp b/samples/write-test.cpp similarity index 98% rename from src/write-test.cpp rename to samples/write-test.cpp index 0226afde..7ed219f0 100644 --- a/src/write-test.cpp +++ b/samples/write-test.cpp @@ -15,9 +15,9 @@ */ // ***************************************************************************** // included header files -#include "image.hpp" -#include "exif.hpp" -#include "makernote.hpp" +#include +#include +#include #include #include diff --git a/src/write2-test.cpp b/samples/write2-test.cpp similarity index 99% rename from src/write2-test.cpp rename to samples/write2-test.cpp index 736d3cf1..0fb17312 100644 --- a/src/write2-test.cpp +++ b/samples/write2-test.cpp @@ -10,8 +10,8 @@ */ // ***************************************************************************** // included header files -#include "image.hpp" -#include "exif.hpp" +#include +#include #include #include #include diff --git a/src/xmpparse.cpp b/samples/xmpparse.cpp similarity index 95% rename from src/xmpparse.cpp rename to samples/xmpparse.cpp index d23a439d..99a9805c 100644 --- a/src/xmpparse.cpp +++ b/samples/xmpparse.cpp @@ -2,9 +2,9 @@ // xmpparse.cpp, $Rev$ // Read an XMP packet from a file, parse it and print all (known) properties. -#include "basicio.hpp" -#include "xmp.hpp" -#include "error.hpp" +#include +#include +#include #include #include diff --git a/src/xmpparser-test.cpp b/samples/xmpparser-test.cpp similarity index 95% rename from src/xmpparser-test.cpp rename to samples/xmpparser-test.cpp index 31a339ee..9f64aa4c 100644 --- a/src/xmpparser-test.cpp +++ b/samples/xmpparser-test.cpp @@ -2,10 +2,10 @@ // xmpparser-test.cpp, $Rev$ // Read an XMP packet from a file, parse and re-serialize it. -#include "basicio.hpp" -#include "xmp.hpp" -#include "error.hpp" -#include "futils.hpp" +#include +#include +#include +#include #include #include diff --git a/src/xmpsample.cpp b/samples/xmpsample.cpp similarity index 99% rename from src/xmpsample.cpp rename to samples/xmpsample.cpp index 3057e08d..2d13ef81 100644 --- a/src/xmpsample.cpp +++ b/samples/xmpsample.cpp @@ -2,8 +2,8 @@ // xmpsample.cpp, $Rev$ // Sample/test for high level XMP classes. See also addmoddel.cpp -#include "xmp.hpp" -#include "error.hpp" +#include +#include #include #include diff --git a/src/Makefile b/src/Makefile index e365a9db..4ee34dcb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,19 +4,31 @@ # # This Makefile is part of the Exiv2 distribution. # -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: # -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. # -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, 5th Floor, Boston, MA 02110-1301 USA. +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # File: Makefile # Version: $Rev$ @@ -102,45 +114,20 @@ CSRC = localtime.c endif # Add source files of simple applications to this list -BINSRC = addmoddel.cpp \ - crwedit.cpp \ - crwparse.cpp \ - dataarea-test.cpp \ - exifcomment.cpp \ - exifdata-test.cpp \ - exifprint.cpp \ - ifd-test.cpp \ - iotest.cpp \ - iptceasy.cpp \ - iptcprint.cpp \ - iptctest.cpp \ - key-test.cpp \ - largeiptc-test.cpp \ - makernote-test.cpp \ - taglist.cpp \ - write-test.cpp \ - write2-test.cpp \ - tiffparse.cpp -ifdef ENABLE_XMP -BINSRC += xmpparse.cpp \ - xmpparser-test.cpp \ - xmpsample.cpp -endif +BINSRC = -# Main source file of the Exiv2 application +# Source files for the Exiv2 application EXIV2MAIN = exiv2.cpp -# Add additional source files of the Exiv2 application to this list -EXIV2SRC = actions.cpp \ - utils.cpp -# C source files of the Exiv2 application +EXIV2SRC = actions.cpp \ + utils.cpp +# C source files for the Exiv2 application ifndef HAVE_TIMEGM -EXIVCSRC = localtime.c +EXIVCSRC = localtime.c endif -# State the main source file of the metacopy application here +# Source files for the metacopy sample application MCMAIN = metacopy.cpp -# Add additional source files of the metacopy application to this list -MCSRC = utils.cpp +MCSRC = utils.cpp # ****************************************************************************** # Library @@ -186,35 +173,14 @@ MCBIN = $(MCMAIN:.cpp=) MCEXE = $(MCMAIN:.cpp=$(EXEEXT)) ifdef DEP_TRACKING -# Compiler flags to generate dependency files at the same time -# as object files (for gcc) -ifeq ($(GXX),yes) - CXXFLAGS += -MMD - CFLAGS += -MMD - MAKEDEPEND = -endif - -DEPDIR = .deps DEP = $(CCSRC:%.cpp=$(DEPDIR)/%.d) $(CSRC:%.c=$(DEPDIR)/%.d) \ $(BINSRC:%.cpp=$(DEPDIR)/%.d) \ $(EXIV2MAIN:%.cpp=$(DEPDIR)/%.d) $(EXIV2SRC:%.cpp=$(DEPDIR)/%.d) \ $(EXIVCSRC:%.c=$(DEPDIR)/%.d) $(MCMAIN:%.cpp=$(DEPDIR)/%.d) \ $(MCSRC:%.cpp=$(DEPDIR)/%.d) $(DEPDIR)/path-test.d -# Dependency files post-process commands -POSTDEPEND = if test ! -d $(DEPDIR); then mkdir $(DEPDIR); fi; \ - if test -e $*.d; then cp $*.d $(DEPDIR)/$*.d; \ - sed -e 's/^\#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ - -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $(DEPDIR)/$*.d; \ - $(RM) $*.d; fi endif -# Compilation shortcuts -COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) -c -# LINK.cc does not need $(LIBS), libtool's dark magic takes care of that -LINK.cc = $(CXX) $(CXXFLAGS) $(LIBRARY) $(LDFLAGS) -rpath $(libdir) - # ****************************************************************************** # Rules $(CCOBJ): %.o: %.cpp @@ -264,20 +230,20 @@ $(LIBTOOL): $(LIBTOOL_DEPS) bin: lib $(BINARY) $(EXIV2BIN) $(MCBIN) path-test lib: $(OBJ) - $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) $(LOBJ) -o $(LIBRARY) -rpath $(libdir) -version-info $(EXIV2_LTVERSION) $(LIBS) + $(LIBTOOL) --mode=link $(LINK.cc) -o $(LIBRARY) $(LOBJ) -rpath $(libdir) -version-info $(EXIV2_LTVERSION) $(LIBS) @touch lib path-test: path-test.o utils.o $(CXX) $(CXXFLAGS) path-test.o utils.o -o $@ $(BINARY): %: %.o lib - @$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $@.o + @$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(LIBRARY) $@.o -rpath $(libdir) $(EXIV2BIN): lib $(EXIV2OBJ) $(EXIV2COBJ) - @$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(EXIV2OBJ) $(EXIV2COBJ) + @$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(LIBRARY) $(EXIV2OBJ) $(EXIV2COBJ) -rpath $(libdir) $(MCBIN): lib $(MCOBJ) - @$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(MCOBJ) + @$(LIBTOOL) --mode=link $(LINK.cc) -o $@ $(LIBRARY) $(MCOBJ) -rpath $(libdir) install-header: $(INSTALL_DIRS) $(DESTDIR)$(incdir) diff --git a/test/Makefile b/test/Makefile index a14ae48d..7cd7f0b1 100644 --- a/test/Makefile +++ b/test/Makefile @@ -1,4 +1,46 @@ # ************************************************************* -*- Makefile -*- +# +# Copyright (C) 2004-2007 Andreas Huggel +# +# This Makefile is part of the Exiv2 distribution. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# File: Makefile +# Version: $Rev$ +# Author(s): Andreas Huggel (ahu) +# History: 26-Dec-04, ahu: created +# +# Description: +# Simple makefile to run the Exiv2 unit tests +# +# Restrictions: +# Only tested with GNU make. +# # Default make target all: test diff --git a/test/addmoddel.sh b/test/addmoddel.sh index 34577d67..8c4f0a28 100755 --- a/test/addmoddel.sh +++ b/test/addmoddel.sh @@ -10,13 +10,12 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" +exiv2="$VALGRIND exiv2" cp -f ./data/exiv2-empty.jpg ./tmp cd ./tmp $binpath/addmoddel exiv2-empty.jpg -$binpath/exiv2 -pv exiv2-empty.jpg +$exiv2 -pv exiv2-empty.jpg ) > $results diff -q $diffargs $results $good diff --git a/test/bugfixes-test.sh b/test/bugfixes-test.sh index 3925e08c..faea5fb0 100755 --- a/test/bugfixes-test.sh +++ b/test/bugfixes-test.sh @@ -20,55 +20,54 @@ prep_file() } ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" +exiv2="$VALGRIND exiv2" cd ./tmp num=426 filename=`prep_file $num` -$binpath/exiv2 -pi $filename +$exiv2 -pi $filename num=440 filename=`prep_file $num` -$binpath/exiv2 -pi $filename +$exiv2 -pi $filename num=443 filename=`prep_file $num` -$binpath/exiv2 -b -pt $filename +$exiv2 -b -pt $filename num=444 filename=`prep_file $num` -$binpath/exiv2 -pi $filename +$exiv2 -pi $filename num=445 filename=`prep_file $num` -$binpath/exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename -$binpath/exiv2 -b -pt $filename +$exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename +$exiv2 -b -pt $filename filename=exiv2-empty.jpg cp -f ../data/$filename . -$binpath/exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename -$binpath/exiv2 -b -pt $filename +$exiv2 -v -M'set Exif.Photo.UserComment A comment' $filename +$exiv2 -b -pt $filename num=447 # Problem only visible in Valgrind filename=`prep_file $num` -$binpath/exiv2 -pi $filename +$exiv2 -pi $filename num=452 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename -$binpath/exiv2 -v -M"set Exif.GPSInfo.GPSLatitude SRational -1/3 -2/3 -3/3" $filename -$binpath/exiv2 -pv $filename -$binpath/exiv2 -v -M"set Exif.GPSInfo.GPSLatitude Rational 1/3 2/3 3/3" $filename -$binpath/exiv2 -pv $filename +$exiv2 -v -M"set Exif.GPSInfo.GPSLatitude SRational -1/3 -2/3 -3/3" $filename +$exiv2 -pv $filename +$exiv2 -v -M"set Exif.GPSInfo.GPSLatitude Rational 1/3 2/3 3/3" $filename +$exiv2 -pv $filename num=460 filename=`prep_file $num` -$binpath/exiv2 -pt $filename +$exiv2 -pt $filename num=479 filename=`prep_file $num` -$binpath/exiv2 -pt $filename +$exiv2 -pt $filename num=480 filename=`prep_file $num` @@ -76,19 +75,19 @@ $binpath/largeiptc-test $filename ../data/imagemagick.png num=495 filename=`prep_file $num` -$binpath/exiv2 -pi $filename +$exiv2 -pi $filename num=498 filename=exiv2-bug$num.jpg cp -f ../data/exiv2-empty.jpg $filename -$binpath/exiv2 -v -M"set Exif.GPSInfo.GPSLatitude 0/1 1/1 2/1" $filename -$binpath/exiv2 -v -pv $filename -$binpath/exiv2 -v -M"del Exif.GPSInfo.GPSLatitude" $filename -$binpath/exiv2 -v -pv $filename +$exiv2 -v -M"set Exif.GPSInfo.GPSLatitude 0/1 1/1 2/1" $filename +$exiv2 -v -pv $filename +$exiv2 -v -M"del Exif.GPSInfo.GPSLatitude" $filename +$exiv2 -v -pv $filename num=501 filename=`prep_file $num` -$binpath/exiv2 -pi $filename +$exiv2 -pi $filename ) > $results 2>&1 diff --git a/test/crw-test.sh b/test/crw-test.sh index e1fe4836..97bf62f0 100755 --- a/test/crw-test.sh +++ b/test/crw-test.sh @@ -16,9 +16,8 @@ fi # ---------------------------------------------------------------------- # Main routine ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" +exiv2="$VALGRIND exiv2" cmdfile=cmdfile crwfile=exiv2-canon-powershot-s40.crw @@ -38,12 +37,12 @@ set Exif.Photo.DateTimeOriginal 2007:11:11 09:10:11 EOF cp -f ../data/$crwfile . -$binpath/exiv2 -v -pt $crwfile +$exiv2 -v -pt $crwfile -$binpath/exiv2 -v -m $cmdfile $crwfile +$exiv2 -v -m $cmdfile $crwfile $binpath/crwparse $crwfile -$binpath/exiv2 -v -pt $crwfile +$exiv2 -v -pt $crwfile # ---------------------------------------------------------------------- # Testcases: Delete tags @@ -53,12 +52,12 @@ del Exif.Canon.OwnerName EOF cp -f ../data/$crwfile . -$binpath/exiv2 -v -pt $crwfile +$exiv2 -v -pt $crwfile -$binpath/exiv2 -v -m $cmdfile $crwfile +$exiv2 -v -m $cmdfile $crwfile $binpath/crwparse $crwfile -$binpath/exiv2 -v -pt $crwfile +$exiv2 -v -pt $crwfile ) > $results 2>&1 diff --git a/test/data/exiv2-test.out b/test/data/exiv2-test.out index 51363b95..e579bbde 100644 --- a/test/data/exiv2-test.out +++ b/test/data/exiv2-test.out @@ -2,7 +2,7 @@ Exiv2 test directory ----------------------------------------------------- tmp/ Exiv2 version ------------------------------------------------------------ -../../src/exiv2 +/usr/local/bin/exiv2 exiv2 0.16 Copyright (C) 2004-2007 Andreas Huggel. diff --git a/test/exifdata-test.sh b/test/exifdata-test.sh index 9cc4c5d3..c8e549f9 100755 --- a/test/exifdata-test.sh +++ b/test/exifdata-test.sh @@ -10,9 +10,7 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" cp -f ./data/exiv2-gc.jpg ./tmp cp -f ./data/exiv2-canon-powershot-s40.jpg ./tmp cp -f ./data/exiv2-nikon-d70.jpg ./tmp diff --git a/test/exiv2-test.sh b/test/exiv2-test.sh index 97c8a58b..535c96d4 100755 --- a/test/exiv2-test.sh +++ b/test/exiv2-test.sh @@ -1,8 +1,6 @@ #! /bin/sh # Test driver for exiv2 utility tests -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -exiv2="$VALGRIND ../../src/exiv2" +exiv2="$VALGRIND exiv2" results="./tmp/exiv2-test.out" good="./data/exiv2-test.out" tmpfile=tmp/ttt @@ -78,7 +76,7 @@ cd tmp/ >/dev/null || exit 1; echo tmp/ echo echo "Exiv2 version ------------------------------------------------------------" -ls $exiv2 || exit 2; +which exiv2 || exit 2; $exiv2 -V echo echo "Exiv2 help ---------------------------------------------------------------" diff --git a/test/ifd-test.sh b/test/ifd-test.sh index f25fb679..1e1fac34 100755 --- a/test/ifd-test.sh +++ b/test/ifd-test.sh @@ -10,9 +10,7 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath=" $VALGRIND ../../src" +binpath=" $VALGRIND ../../samples" cd ./tmp $binpath/ifd-test ) > $results 2>&1 diff --git a/test/iotest.sh b/test/iotest.sh index 44fdb1ff..93520034 100755 --- a/test/iotest.sh +++ b/test/iotest.sh @@ -38,9 +38,7 @@ diffCheck() # ********************************************************************** # main -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" datapath="../data" test_files="table.jpg smiley2.jpg ext.dat" diff --git a/test/iptctest.sh b/test/iptctest.sh index 32466d85..4da30724 100755 --- a/test/iptctest.sh +++ b/test/iptctest.sh @@ -110,9 +110,7 @@ diffCheck() # ********************************************************************** # main -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" datapath="../data" diffargs="--strip-trailing-cr" tmpfile=tmp/ttt diff --git a/test/makernote-test.sh b/test/makernote-test.sh index c3f476fa..163a4b84 100755 --- a/test/makernote-test.sh +++ b/test/makernote-test.sh @@ -10,9 +10,7 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" cd ./tmp $binpath/makernote-test ) > $results diff --git a/test/modify-test.sh b/test/modify-test.sh index 8354dd6e..a62853be 100755 --- a/test/modify-test.sh +++ b/test/modify-test.sh @@ -10,15 +10,13 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" cp -f ./data/exiv2-empty.jpg ./tmp cp -f ./data/exiv2-gc.jpg ./tmp cd ./tmp -$binpath/exiv2 -v -m ../data/modifycmd1.txt exiv2-empty.jpg -$binpath/exiv2 -v -m ../data/modifycmd2.txt exiv2-gc.jpg -$binpath/exiv2 -v -pi exiv2-empty.jpg -$binpath/exiv2 -v -pt exiv2-empty.jpg exiv2-gc.jpg +$VALGRIND exiv2 -v -m ../data/modifycmd1.txt exiv2-empty.jpg +$VALGRIND exiv2 -v -m ../data/modifycmd2.txt exiv2-gc.jpg +$VALGRIND exiv2 -v -pi exiv2-empty.jpg +$VALGRIND exiv2 -v -pt exiv2-empty.jpg exiv2-gc.jpg ) > $results diff --git a/test/write-test.sh b/test/write-test.sh index 2356654d..2818e7ac 100755 --- a/test/write-test.sh +++ b/test/write-test.sh @@ -31,9 +31,7 @@ runTestCase() # ********************************************************************** # main -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" datapath="." diffargs="--strip-trailing-cr" tmpfile=tmp/ttt diff --git a/test/write2-test.sh b/test/write2-test.sh index 8df10db5..fb36e8d9 100755 --- a/test/write2-test.sh +++ b/test/write2-test.sh @@ -10,9 +10,7 @@ if [ $? -ne 0 ] ; then diffargs="" fi ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" cp -f ./data/exiv2-empty.jpg ./tmp cd ./tmp $binpath/write2-test exiv2-empty.jpg diff --git a/test/xmpparser-test.sh b/test/xmpparser-test.sh index 9ddba930..602a6d9a 100755 --- a/test/xmpparser-test.sh +++ b/test/xmpparser-test.sh @@ -3,7 +3,7 @@ # ---------------------------------------------------------------------- # Check if xmpparser-test exists -if [ ! -e ../src/xmpparser-test ] ; then +if [ ! -e ../samples/xmpparser-test ] ; then echo "xmpparser-test not found. Assuming XMP support is not enabled." exit 0 fi @@ -23,9 +23,7 @@ fi # ---------------------------------------------------------------------- # Main routine ( -LD_LIBRARY_PATH=../../src:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH -binpath="$VALGRIND ../../src" +binpath="$VALGRIND ../../samples" cd ./tmp # ---------------------------------------------------------------------- diff --git a/xmpsdk/README b/xmpsdk/README index b37944e3..84b80de3 100644 --- a/xmpsdk/README +++ b/xmpsdk/README @@ -5,16 +5,15 @@ Exiv2 uses the XMPCore component of the Adobe XMP Toolkit (XMP SDK) to parse and serialize XMP packets. Temporarily, it is integrated and distributed together with Exiv2. The xmpsdk/ directory of the Exiv2 distribution (this directory) contains the XMP SDK source code. The -final solution will rely on an external XMP Toolkit, once it is -available as a standalone package from Linux distros. +final solution will use an external XMP Toolkit. Building the XMP Toolkit is transparent. Following the installation steps described in the top-level Exiv2 README file will ensure that the XMP Toolkit is compiled if necessary. It is only needed if XMP -support is enabled. Building the XMP Toolkit results in a static -library xmpsdk/lib/libxmpsdk.a. This library is not installed on the +support is enabled. Building the XMP Toolkit results in a "convenience +library" xmpsdk/lib/libxmpsdk.a. This library is not installed on the system and is not meant to be used as a standalone library. It is -only used to build Exiv2. +only used to link with the Exiv2 library. If you experience problems building this library, please email to the Exiv2 support forum for help, see http://www.exiv2.org/support.html diff --git a/xmpsdk/src/Makefile b/xmpsdk/src/Makefile index fd599882..ae8a0230 100644 --- a/xmpsdk/src/Makefile +++ b/xmpsdk/src/Makefile @@ -4,9 +4,31 @@ # # This Makefile is part of the Exiv2 distribution. # -# NOTICE: You are permitted to use, modify, and distribute this file in -# accordance with the terms of the accompanying license agreement valid for -# the XMP Toolkit. +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following +# disclaimer in the documentation and/or other materials provided +# with the distribution. +# 3. The name of the author may not be used to endorse or promote +# products derived from this software without specific prior +# written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER +# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # # File: Makefile # Version: $Rev$ @@ -14,8 +36,9 @@ # History: 30-Sep-07, ahu: created # # Description: -# Makefile to build the Adobe XMP Toolkit integrated and distributed with -# Exiv2. Adapted from the main Exiv2 src/Makefile. +# Makefile to build a from the Adobe XMP Toolkit integrated and distributed +# with Exiv2. Adapted from the main Exiv2 src/Makefile. This builds what the +# libtool manual calls a "convenience library". # # Restrictions: # Requires GNU make. @@ -50,7 +73,7 @@ CCSRC = XMPMeta.cpp \ # ****************************************************************************** # Library -LIBRARY = libxmpsdk.a +LIBRARY := lib$(XMPSDK_LIBRARY).a # ****************************************************************************** # Initialisations @@ -68,20 +91,18 @@ LIBS += $(EXPAT_LIBS) # Generic variables CCOBJ = $(CCSRC:.cpp=.o) -CCLOBJ = $(CCSRC:.cpp=.lo) +LOBJ = $(CCSRC:.cpp=.lo) -# Compilation shortcuts -COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c -# LINK.cc does not need $(LIBS), libtool's dark magic takes care of that -LINK.cc = $(CXX) $(CXXFLAGS) $(LIBRARY) $(LDFLAGS) +ifdef DEP_TRACKING +DEP = $(CCSRC:%.cpp=$(DEPDIR)/%.d) +endif # ****************************************************************************** # Rules $(CCOBJ): %.o: %.cpp @$(LIBTOOL) --mode=compile $(COMPILE.cc) -o $@ $< -static -prefer-non-pic - -%.o: %.c - $(COMPILE.c) -o $@ $< + @$(MAKEDEPEND) + @$(POSTDEPEND) %.ii: %.cpp set -e; \ @@ -91,13 +112,18 @@ $(CCOBJ): %.o: %.cpp # Targets .PHONY: all mostlyclean clean distclean maintainer-clean install uninstall +ifdef DEP_TRACKING +# Include targets from dependency files +-include $(DEP) +endif + $(LIBTOOL): $(LIBTOOL_DEPS) $(SHELL) $(top_srcdir)/config.status --recheck xmpsdk: install $(LIBRARY): $(CCOBJ) - $(LIBTOOL) --mode=link $(CXX) $(LDFLAGS) $(CCLOBJ) -o $(LIBRARY) -static + $(LIBTOOL) --mode=link $(LINK.cc) -o $(LIBRARY) $(LOBJ) install: $(LIBRARY) $(INSTALL_DATA) $(LIBRARY) ../lib/$(LIBRARY) @@ -109,7 +135,7 @@ mostlyclean: $(RM) core $(RM) $(CCSRC:.cpp=.ii) $(RM) $(CCSRC:%.cpp=.libs/%.d) - @$(LIBTOOL) --mode=clean $(RM) $(CCLOBJ) + @$(LIBTOOL) --mode=clean $(RM) $(LOBJ) clean: uninstall mostlyclean @$(LIBTOOL) --mode=clean $(RM) $(LIBRARY) @@ -117,6 +143,10 @@ clean: uninstall mostlyclean # Run `make distclean' from the top source directory to also remove # files created by configuring the program. distclean: clean +ifdef DEP_TRACKING + $(RM) $(DEP) + -rmdir $(DEPDIR) +endif $(RM) *~ *.bak *# # This command is intended for maintainers to use; it deletes files