Skip to content

Instantly share code, notes, and snippets.

@medigeek
Created February 8, 2012 08:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save medigeek/1766764 to your computer and use it in GitHub Desktop.
Save medigeek/1766764 to your computer and use it in GitHub Desktop.
#!/usr/bin/make -f
# -*- makefile -*-
# Copyright (c) 2012, Savvas Radevic <vicedar@gmail.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Usage: make; sudo make install
# Uninstall: sudo make uninstall
# Clean: make clean
INSTALLDIR=$(DESTDIR)/opt/gtk_tic
all: update-el build-program
precheck-pot:
@which xgettext>/dev/null && echo "Found xgettext" || (echo \
"Could not find xgettext command. Please install it (xgettext)" && exit 1)
build-pot: precheck-pot
rm -f gtk_tic.pot
#intltool-extract --type=gettext/glade gui/gtk_tic.glade
xgettext -L C -k_ -d gtk_tic -o gtk_tic.pot *.c *.h
xgettext -j -d gtk_tic -o gtk_tic.pot gui/gtk_tic.glade
update-el: build-pot
msgmerge -U el.po gtk_tic.pot
msgfmt el.po -o lang/el/LC_MESSAGES/gtk_tic.mo
precheck-program:
@which pkg-config>/dev/null && echo "Found pkg-config" || (echo \
"Could not find pkg-config command. Please install it (pkg-config)" && exit 1)
@pkg-config gtk+-2.0 && echo "Found gtk+-2.0 library devel files" || (echo \
"Could not find gtk+-2.0 library devel files. Please install it (libgtk2.0-dev)" && exit 1)
@which gcc && echo "Found gcc" || (echo \
"Could not find gcc command. Please install it (gcc / build-essential)" && exit 1)
@[ -f /usr/include/locale.h ] && echo "Found locale.h" || (echo \
"Could not find /usr/include/locale.h. It might not be installed. (libc6-dev)")
@[ -f /usr/include/glib-2.0/glib/gi18n.h ] && echo "Found glib/gi18n.h" || (echo \
"Could not find /usr/include/glib-2.0/glib/gi18n.h. It might not be installed. (libglib2.0-dev)")
build-program: precheck-program
gcc -Wall gtk_tic.c -o gtk_tic -export-dynamic `pkg-config --cflags --libs gtk+-2.0`
@echo -e "\n\nAll done.\nRun it: ./gtk_tic\n..or install it using: sudo make install"
@echo "Για ελληνικά: LANGUAGE=el ./gtk_tic"
install:
@[ -f gtk_tic ] && echo "Found gtk_tic" || (echo \
"Could not find ./gtk_tic. Try 'make' first" && exit 1)
mkdir -p $(INSTALLDIR)
mkdir -p $(DESTDIR)/usr/bin
install gtk_tic $(INSTALLDIR)
cp -Rv gui $(INSTALLDIR)/
cp -Rv lang $(INSTALLDIR)/
echo '#!/bin/sh' > $(DESTDIR)/usr/bin/gtk_tic
echo "cd $(INSTALLDIR)" >> $(DESTDIR)/usr/bin/gtk_tic
echo "$(INSTALLDIR)/gtk_tic" >> $(DESTDIR)/usr/bin/gtk_tic
chmod +x $(DESTDIR)/usr/bin/gtk_tic
@echo -e "\n\nAll done.\nRun it: $(DESTDIR)/usr/bin/gtk_tic"
@echo "Για ελληνικά: LANGUAGE=el $(DESTDIR)/usr/bin/gtk_tic"
uninstall:
rm -f $(DESTDIR)/usr/bin/gtk_tic
rm -rf $(INSTALLDIR)
clean:
rm -f *~
rm -f gtk_tic
distclean: clean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment