####################################################################### # Makefile for qiv - Quick Image Viewer - http://qiv.spiegl.de/ # User Options ####################################################################### # Directory where qiv will be installed under. PREFIX ?= /usr/local # Fonts to use for statusbar and comments STATUSBAR_FONT = "Monospace 9" COMMENT_FONT = "Monospace 20" ARTIST_FONT = "Monospace 10" # Cursor to use on qiv windows - see # gdk/gdkcursor.h for more choices. CURSOR = GDK_MOUSE # Should image be centered on screen by default? 1=yes, 0=no. CENTER = 1 # Should images be filtered by extension and libmagic? 1=yes, 0=no. FILTER = 1 # This sets the file extentions to filter on (other file types will be # skipped.) It should reflect whatever can be loaded via gdk-pixbuf-loader. EXTNS = GIF TIFF XPM TGA PNG PPM PNM PGM PCX BMP EIM JPEG SVG WMF ICO ICNS WEBP HEIF # Comment this line out if your system doesn't have getopt_long(). GETOPT_LONG = -DHAVE_GETOPT_LONG # This program will be run on the manual page after it is installed. # If you don't want to compress the manpage, change it to 'true'. COMPRESS_PROG ?= gzip -9f # Comment this line out if your system doesn't have lcms2 installed # (for minimal Color Management support) LCMS = -DSUPPORT_LCMS # Comment this line out if you do not want to use libmagic to # identify if a file is an image MAGIC = -DHAVE_MAGIC # Comment this line out if you do not want to use libexif to # display the exif contents of a jpg EXIF = -DHAVE_EXIF ###################################################################### # Variables and Rules # Do not edit below here! ###################################################################### ifeq ($(origin CC),default) CC ?= gcc endif PKG_CONFIG ?= pkg-config INSTALL ?= install STRIP_FLAG ?= -s CFLAGS ?= -O2 -Wall \ -fcaller-saves -ffast-math -fno-strength-reduce \ -fthread-jumps GDK_VERS ?= 3 ifeq ($(GDK_VERS), 3) INCLUDES := $(shell $(PKG_CONFIG) --cflags gdk-3.0 ) LIBS := $(shell $(PKG_CONFIG) --libs gdk-3.0 ) -lX11 -lXext -lgio-2.0 -lm else INCLUDES := $(shell $(PKG_CONFIG) --cflags gdk-2.0) LIBS := $(shell $(PKG_CONFIG) --libs gdk-2.0) -lX11 -lXext -lgio-2.0 -lm endif # [as] thinks that this is not portable enough: # [lc] I use a virtual screen of 1600x1200, and the resolution is 1024x768, # so I changed (in main.c) how screen_[x,y] is obtained; it seems that gtk # 1.2 cannot give the geometry of viewport, so I borrowed from the source # of xvidtune the code for calling XF86VidModeGetModeLine, this requires # the linking option -lXxf86vm. #LIBS += -lXxf86vm PROGRAM = qiv OBJS = main.o image.o event.o options.o utils.o xmalloc.o HEADERS = qiv.h DEFINES = $(patsubst %,-DEXTN_%, $(EXTNS)) \ $(GETOPT_LONG) \ -DSTATUSBAR_FONT='$(STATUSBAR_FONT)' \ -DCOMMENT_FONT='$(COMMENT_FONT)' \ -DARTIST_FONT='$(ARTIST_FONT)' \ -DCENTER=$(CENTER) \ -DFILTER=$(FILTER) \ -DCURSOR=$(CURSOR) \ $(MAGIC) \ $(EXIF) \ $(LCMS) ifndef GETOPT_LONG OBJS += lib/getopt.o lib/getopt1.o OBJS_G += lib/getopt.g lib/getopt1.g endif ifdef LCMS INCLUDES += $(shell $(PKG_CONFIG) --cflags lcms2) LIBS += $(shell $(PKG_CONFIG) --libs lcms2) -ljpeg -ltiff endif ifdef EXIF INCLUDES += $(shell $(PKG_CONFIG) --cflags libexif) LIBS += $(shell $(PKG_CONFIG) --libs libexif) endif ifdef MAGIC LIBS += -lmagic endif PROGRAM_G = qiv-g OBJS_G = $(OBJS:.o=.g) DEFINES_G = $(DEFINES) -DDEBUG ###################################################################### all: $(PROGRAM) $(PROGRAM): $(OBJS) $(CC) $(CFLAGS) $(DEFINES) $(OBJS) $(LDFLAGS) $(LIBS) -o $(PROGRAM) $(OBJS): %.o: %.c $(HEADERS) Makefile $(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ main.o: main.h ###################################################################### debug: $(PROGRAM_G) $(PROGRAM_G): $(OBJS_G) $(CC) -g $(CFLAGS) $(DEFINES_G) $(OBJS_G) $(LDFLAGS) $(LIBS) -o $(PROGRAM_G) $(OBJS_G): %.g: %.c $(HEADERS) $(CC) -c -g $(CFLAGS) $(DEFINES_G) $(INCLUDES) $< -o $@ ###################################################################### clean : @echo "Cleaning up..." rm -f $(OBJS) $(OBJS_G) distclean : clean rm -f $(PROGRAM) $(PROGRAM_G) install: $(PROGRAM) @echo "Installing QIV..." @if [ ! -e $(PREFIX)/bin ]; then \ $(INSTALL) -d -m 0755 $(PREFIX)/bin; \ echo install -d -m 0755 $(PREFIX)/bin; \ fi $(INSTALL) $(STRIP_FLAG) -m 0755 $(PROGRAM) $(PREFIX)/bin @if [ ! -e $(PREFIX)/share/man/man1 ]; then \ echo install -d -m 0755 $(PREFIX)/share/man/man1; \ $(INSTALL) -d -m 0755 $(PREFIX)/share/man/man1; \ fi $(INSTALL) -m 0644 $(PROGRAM).1 $(PREFIX)/share/man/man1 $(COMPRESS_PROG) $(PREFIX)/share/man/man1/$(PROGRAM).1 @if [ ! -e $(PREFIX)/share/pixmaps ]; then \ echo install -d -m 0755 $(PREFIX)/share/pixmaps; \ $(INSTALL) -d -m 0755 $(PREFIX)/share/pixmaps; \ fi $(INSTALL) -m 0644 qiv.png $(PREFIX)/share/pixmaps/qiv.png @if [ ! -e $(PREFIX)/share/applications ]; then \ echo install -d -m 0755 $(PREFIX)/share/applications; \ $(INSTALL) -d -m 0755 $(PREFIX)/share/applications; \ fi $(INSTALL) -m 0644 qiv.desktop $(PREFIX)/share/applications/qiv.desktop @echo "\nDont forget to look into the \"qiv-command\" file and install it!\n-> cp qiv-command.example $(PREFIX)/bin/qiv-command\n\n" check: $(PROGRAM) @if ./qiv -f ./intro.jpg ; \ then echo "-- Test Passed --" ; \ else echo "-- Test Failed --" ; \ fi # the end... ;-)