summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-11 15:58:38 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2011-10-11 20:29:06 -0700
commit7df7518625b5a80aa1ff35c8c6e49e6e257672d9 (patch)
tree02d7b54df83f0d0e01cc6c7b87f61775e01260a5 /Makefile
parent089ab5e97c50de9e0f566bda9e881e0e3c7cb0bf (diff)
downloadsubsurface-7df7518625b5a80aa1ff35c8c6e49e6e257672d9.tar.gz
Have "make install" act more as expected for a desktop application
I'm trying to get subsurface to get closer to becoming a "regular desktop application"; so far this is based on the recommendations and guidelines on OpenSUSE and Fedora. The icon is now named subsurface.svg and make install installs it in the correct location. At runtime subsurface first checks if an icon is installed and if it is it uses that - otherwise it falls back to the old code that tries to read the svg file from the current directory. We also install a subsurface.desktop file Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 15 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 0c67f40f7..e05b44e94 100644
--- a/Makefile
+++ b/Makefile
@@ -4,9 +4,18 @@ CC=gcc
CFLAGS=-Wall -Wno-pointer-sign -g
INSTALL=install
-prefix = $(HOME)
+# these locations seem to work for SuSE and Fedora
+# prefix = $(HOME)
+prefix = /usr
DESTDIR = $(prefix)/bin
+DESKTOPDIR = $(prefix)/share/applications
+ICONPATH = $(prefix)/share/icons/hicolor
+ICONDIR = $(ICONPATH)/scalable/apps
+gtk_update_icon_cache = gtk-update-icon-cache -f -t $(ICONPATH)
+
NAME = subsurface
+ICONFILE = $(NAME).svg
+DESKTOPFILE = $(NAME).desktop
# find libdivecomputer; we don't trust pkg-config here given how young
# libdivecomputer still is - so we check /usr/local and /usr and then we
@@ -49,6 +58,11 @@ $(NAME): $(OBJS)
install: $(NAME)
$(INSTALL) -d -m 755 $(DESTDIR)
$(INSTALL) $(NAME) $(DESTDIR)
+ $(INSTALL) -d -m 755 $(DESKTOPDIR)
+ $(INSTALL) $(DESKTOPFILE) $(DESKTOPDIR)
+ $(INSTALL) -d -m 755 $(ICONDIR)
+ $(INSTALL) $(ICONFILE) $(ICONDIR)
+ $(gtk_update_icon_cache)
parse-xml.o: parse-xml.c dive.h
$(CC) $(CFLAGS) `pkg-config --cflags glib-2.0` -c `xml2-config --cflags` parse-xml.c