Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Changes to Makefile library dependencies

It now uses pkg-config to get the exiv2 compiler flags and only
runs pkg-config one time instead of for every compiled file.
Also, the command-line tool no longer links against the GUI
libraries.
  • Loading branch information...
commit bf5bc402db52853c604ee082afb26d4de476e3c5 1 parent a52c046
Dan Fandrich dfandrich authored
Showing with 23 additions and 14 deletions.
  1. +15 −8 Makefile
  2. +3 −3 Makefile.mingw32
  3. +3 −3 README.md
  4. +2 −0  RELEASES
23 Makefile
View
@@ -9,9 +9,13 @@ CXX = g++
COBJS = main-command.o unixtime.o gpx-read.o correlate.o exif-gps.o
GOBJS = main-gui.o gui.o unixtime.o gpx-read.o correlate.o exif-gps.o
CFLAGS = -Wall -O2
-override CFLAGS += $(shell pkg-config --cflags libxml-2.0 gtk+-2.0) -I/usr/include/exiv2
-OFLAGS = -Wall -O2
-override OFLAGS += $(shell pkg-config --libs libxml-2.0 gtk+-2.0) -lm -lexiv2
+CFLAGSINC := $(shell pkg-config --cflags libxml-2.0 exiv2)
+# Add the gtk+ flags only when building the GUI
+gpscorrelate-gui: CFLAGSINC += $(shell pkg-config --cflags gtk+-2.0)
+LDFLAGS = -Wall -O2
+LDFLAGSALL := $(shell pkg-config --libs libxml-2.0 exiv2) -lm
+LDFLAGSGUI := $(shell pkg-config --libs gtk+-2.0)
+
prefix = /usr/local
bindir = $(prefix)/bin
datadir = $(prefix)/share
@@ -21,21 +25,24 @@ applicationsdir = $(datadir)/applications
DEFS = -DPACKAGE_VERSION=\"$(PACKAGE_VERSION)\"
-TARGETS = gpscorrelate gpscorrelate-gui gpscorrelate.1
+TARGETS = gpscorrelate-gui gpscorrelate gpscorrelate.1
all: $(TARGETS)
gpscorrelate: $(COBJS)
- $(CXX) $(OFLAGS) -o $@ $(COBJS)
+ $(CXX) -o $@ $(COBJS) $(LDFLAGS) $(LDFLAGSALL)
gpscorrelate-gui: $(GOBJS)
- $(CXX) $(OFLAGS) -o $@ $(GOBJS)
+ $(CXX) -o $@ $(GOBJS) $(LDFLAGS) $(LDFLAGSGUI) $(LDFLAGSALL)
.c.o:
- $(CC) $(CFLAGS) $(DEFS) -c -o $*.o $<
+ $(CC) $(CFLAGS) $(CFLAGSINC) $(DEFS) -c -o $@ $<
.cpp.o:
- $(CXX) $(CFLAGS) $(DEFS) -c -o $*.o $<
+ $(CXX) $(CFLAGS) $(CFLAGSINC) $(DEFS) -c -o $@ $<
+
+# Hack to recompile everything if a header changes
+*.o: *.h
clean:
rm -f *.o gpscorrelate{,.exe} gpscorrelate-gui{,.exe} doc/gpscorrelate-manpage.xml $(TARGETS)
6 Makefile.mingw32
View
@@ -1,4 +1,4 @@
-# Makefile for gpscorrelate
+# Makefile for gpscorrelate for cross-compiling with MinGW32
# Written by Daniel Foote.
CC = i486-mingw32-gcc
@@ -18,10 +18,10 @@ gpscorrelate-gui.exe: $(GOBJS)
$(CXX) -o $@ $(GOBJS) $(OFLAGS)
.c.o:
- $(CC) $(CFLAGS) -c -o $*.o $<
+ $(CC) $(CFLAGS) -c -o $@ $<
.cpp.o:
- $(CXX) $(CFLAGS) -c -o $*.o $<
+ $(CXX) $(CFLAGS) -c -o $@ $<
clean:
rm -f *.o gpscorrelate{,.exe} gpscorrelate-gui{,.exe}
6 README.md
View
@@ -34,11 +34,11 @@ So I wrote my own. A little bit of C, a little bit of C++, a shade of GTK+, and
To build, you will need:
* The Exiv2 library (C++ EXIF tag handling): http://www.exiv2.org/
-* libxml
-* GTK+ (if compiling the GUI).
+* libxml2 (XML parsing): http://www.xmlsoft.org/
+* GTK+ (if compiling the GUI): http://www.gtk.org
You can build the command line version and the GUI together simply with
-"make". There is presently no "make install".
+"make" and install it with "sudo make install"
## Release History
2  RELEASES
View
@@ -124,3 +124,5 @@ v1.X: TBD
been touched)
- Store GPS coordinates in such a way as to preserve the number of
significant figures of the original data
+ - Use pkg-config to get the exiv2 compiler flags when building
+ - Renamed OFLAGS to LDFLAGS which is a more common name
Please sign in to comment.
Something went wrong with that request. Please try again.