| 1 |
####################################################################### |
| 2 |
# Makefile for qiv - Quick Image Viewer - http://qiv.spiegl.de/ |
| 3 |
# User Options |
| 4 |
####################################################################### |
| 5 |
|
| 6 |
# Directory where qiv will be installed under. |
| 7 |
PREFIX ?= /usr/local |
| 8 |
|
| 9 |
# Fonts to use for statusbar and comments |
| 10 |
STATUSBAR_FONT = "Monospace 9" |
| 11 |
COMMENT_FONT = "Monospace 20" |
| 12 |
ARTIST_FONT = "Monospace 10" |
| 13 |
|
| 14 |
# Cursor to use on qiv windows - see |
| 15 |
# gdk/gdkcursor.h for more choices. |
| 16 |
CURSOR = GDK_MOUSE |
| 17 |
|
| 18 |
# Should image be centered on screen by default? 1=yes, 0=no. |
| 19 |
CENTER = 1 |
| 20 |
|
| 21 |
# Should images be filtered by extension and libmagic? 1=yes, 0=no. |
| 22 |
FILTER = 1 |
| 23 |
|
| 24 |
# This sets the file extentions to filter on (other file types will be |
| 25 |
# skipped.) It should reflect whatever can be loaded via gdk-pixbuf-loader. |
| 26 |
EXTNS = GIF TIFF XPM TGA PNG PPM PNM PGM PCX BMP EIM JPEG SVG WMF ICO ICNS WEBP HEIF |
| 27 |
|
| 28 |
# Comment this line out if your system doesn't have getopt_long(). |
| 29 |
GETOPT_LONG = -DHAVE_GETOPT_LONG |
| 30 |
|
| 31 |
# This program will be run on the manual page after it is installed. |
| 32 |
# If you don't want to compress the manpage, change it to 'true'. |
| 33 |
COMPRESS_PROG ?= gzip -9f |
| 34 |
|
| 35 |
# Comment this line out if your system doesn't have lcms2 installed |
| 36 |
# (for minimal Color Management support) |
| 37 |
LCMS = -DSUPPORT_LCMS |
| 38 |
|
| 39 |
# Comment this line out if you do not want to use libmagic to |
| 40 |
# identify if a file is an image |
| 41 |
MAGIC = -DHAVE_MAGIC |
| 42 |
|
| 43 |
# Comment this line out if you do not want to use libexif to |
| 44 |
# display the exif contents of a jpg |
| 45 |
EXIF = -DHAVE_EXIF |
| 46 |
|
| 47 |
###################################################################### |
| 48 |
# Variables and Rules |
| 49 |
# Do not edit below here! |
| 50 |
###################################################################### |
| 51 |
|
| 52 |
ifeq ($(origin CC),default) |
| 53 |
CC ?= gcc |
| 54 |
endif |
| 55 |
|
| 56 |
PKG_CONFIG ?= pkg-config |
| 57 |
INSTALL ?= install |
| 58 |
STRIP_FLAG ?= -s |
| 59 |
CFLAGS ?= -O2 -Wall \ |
| 60 |
-fcaller-saves -ffast-math -fno-strength-reduce \ |
| 61 |
-fthread-jumps |
| 62 |
|
| 63 |
GDK_VERS ?= 3 |
| 64 |
|
| 65 |
ifeq ($(GDK_VERS), 3) |
| 66 |
INCLUDES := $(shell $(PKG_CONFIG) --cflags gdk-3.0 ) |
| 67 |
LIBS := $(shell $(PKG_CONFIG) --libs gdk-3.0 ) -lX11 -lXext -lgio-2.0 -lm |
| 68 |
else |
| 69 |
INCLUDES := $(shell $(PKG_CONFIG) --cflags gdk-2.0) |
| 70 |
LIBS := $(shell $(PKG_CONFIG) --libs gdk-2.0) -lX11 -lXext -lgio-2.0 -lm |
| 71 |
endif |
| 72 |
|
| 73 |
# [as] thinks that this is not portable enough: |
| 74 |
# [lc] I use a virtual screen of 1600x1200, and the resolution is 1024x768, |
| 75 |
# so I changed (in main.c) how screen_[x,y] is obtained; it seems that gtk |
| 76 |
# 1.2 cannot give the geometry of viewport, so I borrowed from the source |
| 77 |
# of xvidtune the code for calling XF86VidModeGetModeLine, this requires |
| 78 |
# the linking option -lXxf86vm. |
| 79 |
#LIBS += -lXxf86vm |
| 80 |
|
| 81 |
PROGRAM = qiv |
| 82 |
OBJS = main.o image.o event.o options.o utils.o xmalloc.o |
| 83 |
HEADERS = qiv.h |
| 84 |
DEFINES = $(patsubst %,-DEXTN_%, $(EXTNS)) \ |
| 85 |
$(GETOPT_LONG) \ |
| 86 |
-DSTATUSBAR_FONT='$(STATUSBAR_FONT)' \ |
| 87 |
-DCOMMENT_FONT='$(COMMENT_FONT)' \ |
| 88 |
-DARTIST_FONT='$(ARTIST_FONT)' \ |
| 89 |
-DCENTER=$(CENTER) \ |
| 90 |
-DFILTER=$(FILTER) \ |
| 91 |
-DCURSOR=$(CURSOR) \ |
| 92 |
$(MAGIC) \ |
| 93 |
$(EXIF) \ |
| 94 |
$(LCMS) |
| 95 |
|
| 96 |
ifndef GETOPT_LONG |
| 97 |
OBJS += lib/getopt.o lib/getopt1.o |
| 98 |
OBJS_G += lib/getopt.g lib/getopt1.g |
| 99 |
endif |
| 100 |
|
| 101 |
ifdef LCMS |
| 102 |
INCLUDES += $(shell $(PKG_CONFIG) --cflags lcms2) |
| 103 |
LIBS += $(shell $(PKG_CONFIG) --libs lcms2) -ljpeg -ltiff |
| 104 |
endif |
| 105 |
|
| 106 |
ifdef EXIF |
| 107 |
INCLUDES += $(shell $(PKG_CONFIG) --cflags libexif) |
| 108 |
LIBS += $(shell $(PKG_CONFIG) --libs libexif) |
| 109 |
endif |
| 110 |
|
| 111 |
ifdef MAGIC |
| 112 |
LIBS += -lmagic |
| 113 |
endif |
| 114 |
|
| 115 |
PROGRAM_G = qiv-g |
| 116 |
OBJS_G = $(OBJS:.o=.g) |
| 117 |
DEFINES_G = $(DEFINES) -DDEBUG |
| 118 |
|
| 119 |
###################################################################### |
| 120 |
|
| 121 |
all: $(PROGRAM) |
| 122 |
|
| 123 |
$(PROGRAM): $(OBJS) |
| 124 |
$(CC) $(CFLAGS) $(DEFINES) $(OBJS) $(LDFLAGS) $(LIBS) -o $(PROGRAM) |
| 125 |
|
| 126 |
$(OBJS): %.o: %.c $(HEADERS) Makefile |
| 127 |
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(DEFINES) $(INCLUDES) $< -o $@ |
| 128 |
|
| 129 |
main.o: main.h |
| 130 |
|
| 131 |
###################################################################### |
| 132 |
|
| 133 |
debug: $(PROGRAM_G) |
| 134 |
|
| 135 |
$(PROGRAM_G): $(OBJS_G) |
| 136 |
$(CC) -g $(CFLAGS) $(DEFINES_G) $(OBJS_G) $(LDFLAGS) $(LIBS) -o $(PROGRAM_G) |
| 137 |
|
| 138 |
$(OBJS_G): %.g: %.c $(HEADERS) |
| 139 |
$(CC) -c -g $(CFLAGS) $(DEFINES_G) $(INCLUDES) $< -o $@ |
| 140 |
|
| 141 |
###################################################################### |
| 142 |
|
| 143 |
clean : |
| 144 |
@echo "Cleaning up..." |
| 145 |
rm -f $(OBJS) $(OBJS_G) |
| 146 |
|
| 147 |
distclean : clean |
| 148 |
rm -f $(PROGRAM) $(PROGRAM_G) |
| 149 |
|
| 150 |
install: $(PROGRAM) |
| 151 |
@echo "Installing QIV..." |
| 152 |
@if [ ! -e $(PREFIX)/bin ]; then \ |
| 153 |
$(INSTALL) -d -m 0755 $(PREFIX)/bin; \ |
| 154 |
echo install -d -m 0755 $(PREFIX)/bin; \ |
| 155 |
fi |
| 156 |
$(INSTALL) $(STRIP_FLAG) -m 0755 $(PROGRAM) $(PREFIX)/bin |
| 157 |
@if [ ! -e $(PREFIX)/share/man/man1 ]; then \ |
| 158 |
echo install -d -m 0755 $(PREFIX)/share/man/man1; \ |
| 159 |
$(INSTALL) -d -m 0755 $(PREFIX)/share/man/man1; \ |
| 160 |
fi |
| 161 |
$(INSTALL) -m 0644 $(PROGRAM).1 $(PREFIX)/share/man/man1 |
| 162 |
$(COMPRESS_PROG) $(PREFIX)/share/man/man1/$(PROGRAM).1 |
| 163 |
@if [ ! -e $(PREFIX)/share/pixmaps ]; then \ |
| 164 |
echo install -d -m 0755 $(PREFIX)/share/pixmaps; \ |
| 165 |
$(INSTALL) -d -m 0755 $(PREFIX)/share/pixmaps; \ |
| 166 |
fi |
| 167 |
$(INSTALL) -m 0644 qiv.png $(PREFIX)/share/pixmaps/qiv.png |
| 168 |
@if [ ! -e $(PREFIX)/share/applications ]; then \ |
| 169 |
echo install -d -m 0755 $(PREFIX)/share/applications; \ |
| 170 |
$(INSTALL) -d -m 0755 $(PREFIX)/share/applications; \ |
| 171 |
fi |
| 172 |
$(INSTALL) -m 0644 qiv.desktop $(PREFIX)/share/applications/qiv.desktop |
| 173 |
@echo "\nDont forget to look into the \"qiv-command\" file and install it!\n-> cp qiv-command.example $(PREFIX)/bin/qiv-command\n\n" |
| 174 |
|
| 175 |
check: $(PROGRAM) |
| 176 |
@if ./qiv -f ./intro.jpg ; \ |
| 177 |
then echo "-- Test Passed --" ; \ |
| 178 |
else echo "-- Test Failed --" ; \ |
| 179 |
fi |
| 180 |
|
| 181 |
# the end... ;-) |