summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-03-27 12:16:01 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2010-03-27 12:16:01 +0100
commitea00c2fc6d91d71b8cf3c8408af8ca8de7c037a6 (patch)
treed113e1e07c6ae4fe7b9b3d27d35b1e23885abbad
parent69d69f145763f01724efdce119f6312272022740 (diff)
Makefile/config.mk: Support getting the usual values from the environment.
No need to edit config.mk to set addictional CFLAGS/LDFLAGS or change the DESTDIR etc. now
-rw-r--r--Makefile71
-rw-r--r--README5
-rw-r--r--config.mk43
-rw-r--r--src/Makefile12
4 files changed, 64 insertions, 67 deletions
diff --git a/Makefile b/Makefile
index a5bc3f0..a409c36 100644
--- a/Makefile
+++ b/Makefile
@@ -1,62 +1,63 @@
include config.mk
default:
- @$(MAKE) -C src
+ @${MAKE} -C src
install: install-man install-doc install-bin install-font install-img
install-man:
- @echo installing manuals to $(man_dir)
- @mkdir -p $(man_dir)/man1
- @cp man/feh.1 man/feh-cam.1 $(man_dir)/man1
+ @echo installing manuals to ${man_dir}
+ @mkdir -p ${man_dir}/man1
+ @cp man/feh.1 man/feh-cam.1 ${man_dir}/man1
@chmod 644 $(man_dir)/man1/feh.1 $(man_dir)/man1/feh-cam.1
@ln -fs feh-cam.1 $(man_dir)/man1/gen-cam-menu.1
install-doc:
- @echo installing docs to $(doc_dir)
- @mkdir -p $(doc_dir)/feh
- @cp AUTHORS ChangeLog README TODO $(doc_dir)/feh
- @chmod 644 $(doc_dir)/feh/AUTHORS $(doc_dir)/feh/ChangeLog \
- $(doc_dir)/feh/README $(doc_dir)/feh/TODO
+ @echo installing docs to ${doc_dir}
+ @mkdir -p ${doc_dir}/feh
+ @cp AUTHORS ChangeLog README TODO ${doc_dir}/feh
+ @chmod 644 ${doc_dir}/feh/AUTHORS ${doc_dir}/feh/ChangeLog \
+ ${doc_dir}/feh/README ${doc_dir}/feh/TODO
install-bin:
- @echo installing executables to $(bin_dir)
- @mkdir -p $(bin_dir)
- @cp src/feh cam/feh-cam cam/gen-cam-menu $(bin_dir)
- @chmod 755 $(bin_dir)/feh $(bin_dir)/feh-cam \
- $(bin_dir)/gen-cam-menu
+ @echo installing executables to ${bin_dir}
+ @mkdir -p ${bin_dir}
+ @cp src/feh cam/feh-cam cam/gen-cam-menu ${bin_dir}
+ @chmod 755 ${bin_dir}/feh ${bin_dir}/feh-cam \
+ ${bin_dir}/gen-cam-menu
install-font:
- @echo installing fonts to $(font_dir)
- @mkdir -p $(font_dir)
+ @echo installing fonts to ${font_dir}
+ @mkdir -p ${font_dir}
@cp src/ttfonts/black.style src/ttfonts/menu.style \
- src/ttfonts/yudit.ttf $(font_dir)
- @chmod 644 $(font_dir)/black.style $(font_dir)/menu.style \
- $(font_dir)/yudit.ttf
+ src/ttfonts/yudit.ttf ${font_dir}
+ @chmod 644 ${font_dir}/black.style ${font_dir}/menu.style \
+ ${font_dir}/yudit.ttf
install-img:
- @echo installing images to $(image_dir)
- @mkdir -p $(image_dir)
+ @echo installing images to ${image_dir}
+ @mkdir -p ${image_dir}
@cp src/about.png src/menubg_aluminium.png src/menubg_aqua.png \
src/menubg_black.png src/menubg_brushed.png src/menubg_chrome.png \
src/menubg_default.png src/menubg_pastel.png src/menubg_sky.png \
- src/menubg_wood.png $(image_dir)
- @chmod 644 $(image_dir)/about.png $(image_dir)/menubg_aluminium.png \
- $(image_dir)/menubg_aqua.png $(image_dir)/menubg_black.png \
- $(image_dir)/menubg_brushed.png $(image_dir)/menubg_chrome.png \
- $(image_dir)/menubg_default.png $(image_dir)/menubg_pastel.png \
- $(image_dir)/menubg_sky.png $(image_dir)/menubg_wood.png
+ src/menubg_wood.png ${image_dir}
+ @chmod 644 ${image_dir}/about.png ${image_dir}/menubg_aluminium.png \
+ ${image_dir}/menubg_aqua.png ${image_dir}/menubg_black.png \
+ ${image_dir}/menubg_brushed.png ${image_dir}/menubg_chrome.png \
+ ${image_dir}/menubg_default.png ${image_dir}/menubg_pastel.png \
+ ${image_dir}/menubg_sky.png ${image_dir}/menubg_wood.png
uninstall:
- rm -f $(man_dir)/man1/feh.1 $(man_dir)/man1/feh-cam.1
- rm -f $(man_dir)/man1/gen-cam-menu.1
- rm -rf $(doc_dir)
- rm -f $(bin_dir)/feh $(bin_dir)/feh-cam $(bin_dir)/gen-cam-menu
- rm -rf $(font_dir)
- rm -rf $(image_dir)
+ rm -f ${man_dir}/man1/feh.1 ${man_dir}/man1/feh-cam.1
+ rm -f ${man_dir}/man1/gen-cam-menu.1
+ rm -rf ${doc_dir}
+ rm -f ${bin_dir}/feh ${bin_dir}/feh-cam ${bin_dir}/gen-cam-menu
+ rm -rf ${font_dir}
+ rm -rf ${image_dir}
clean:
- @$(MAKE) -C src clean
+ @${MAKE} -C src clean
-.PHONY: default install uninstall clean
+.PHONY: default install uninstall clean install-man install-doc install-bin \
+ install-font install-img
diff --git a/README b/README
index 61db615..117898e 100644
--- a/README
+++ b/README
@@ -6,6 +6,11 @@ $ sudo make install
If compilation does not work or you want to customize stuff (like disable
Xinerama support), edit config.mk first.
+Note: config.mk is designed so that in most cases, you can set environment
+variables instead of editing it. E.g.:
+CFLAGS='-g -Os' make
+export DESTDIR=/tmp/feh PREFIX=/usr; make && make install
+
What is feh?
http://linuxbrit.co.uk/feh/
diff --git a/config.mk b/config.mk
index f254354..03c3d4d 100644
--- a/config.mk
+++ b/config.mk
@@ -1,45 +1,36 @@
-package = feh
-version = 1.4.1-git
-
-# Customize below:
+PACKAGE ?= feh
+VERSION ?= 1.4.1-git
# Prefix for all installed files
-prefix = /usr/local
+PREFIX ?= /usr/local
# Directories for manuals, executables, docs, data, etc.
-man_dir = $(prefix)/share/man
-bin_dir = $(prefix)/bin
-doc_dir = $(prefix)/share/doc
-image_dir = $(prefix)/share/feh/images
-font_dir = $(prefix)/share/feh/fonts
+main_dir = ${DESTDIR}${PREFIX}
+man_dir = ${main_dir}/share/man
+bin_dir = ${main_dir}/bin
+doc_dir = ${main_dir}/share/doc
+image_dir = ${main_dir}/share/feh/images
+font_dir = ${main_dir}/share/feh/fonts
# default CFLAGS
-CFLAGS = -g -Wall -Wextra -pedantic -O2
+CFLAGS ?= -g -O2
+CFLAGS += -Wall -Wextra -pedantic
# Comment these out if you don't have libxinerama
xinerama = -DHAVE_LIBXINERAMA
xinerama_ld = -lXinerama
-# Put extra header (-I/some/directory) directories here
-extra_headers =
-
-# Put extra include (-L/some/directory) directories here
-extra_libs =
-
debug = -DDEBUG
# Uncomment this for debug mode
# (Use feh -+ <level> to see debug output)
-#CFLAGS += $(debug)
+#CFLAGS += ${debug}
dmalloc = -DWITH_DMALLOC
# Uncomment this to use dmalloc
-#CFLAGS += $(dmalloc)
-
-
-# You should not need to change anything below this line.
+#CFLAGS += ${dmalloc}
-CFLAGS += $(extra_headers) $(xinerama) -DPREFIX=\"$(prefix)\" \
- -DPACKAGE=\"$(package)\" -DVERSION=\"$(version)\"
+CFLAGS += ${xinerama} -DPREFIX=\"${PREFIX}\" \
+ -DPACKAGE=\"${PACKAGE}\" -DVERSION=\"${VERSION}\"
-LDFLAGS = -lpng -lX11 -lImlib2 -lfreetype -lXext -lgiblib \
- $(xinerama_ld) $(extra_includes)
+LDFLAGS += -lpng -lX11 -lImlib2 -lfreetype -lXext -lgiblib \
+ ${xinerama_ld} ${extra_includes}
diff --git a/src/Makefile b/src/Makefile
index b23bde0..a5ea9b0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,13 +1,13 @@
include ../config.mk
-TARGETS = $(shell echo *.c)
-OBJECTS = $(TARGETS:.c=.o)
+TARGETS = ${shell echo *.c}
+OBJECTS = ${TARGETS:.c=.o}
-feh: deps.mk $(OBJECTS)
- $(CC) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
+feh: deps.mk ${OBJECTS}
+ ${CC} ${CFLAGS} -o $@ ${OBJECTS} ${LDFLAGS}
-deps.mk: $(TARGETS)
- $(CC) -MM $(TARGETS) > $@
+deps.mk: ${TARGETS}
+ ${CC} -MM ${TARGETS} > $@
include deps.mk