#  Makefile - Frontend for SAFT for X11
#  Copyright (c) 1999,2006  Joey Schulze <joey@infodrom.org>
#
#  This file is part of the Gerstensaft package.
#
#  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 2 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, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.

prefix = /usr/local

CC = gcc

CFLAGS=-g -Wall \
	-DG_DISABLE_DEPRECATED \
	-DGDK_DISABLE_DEPRECATED \
	-DGDK_PIXBUF_DISABLE_DEPRECATED


GTK_CFLAGS=$(shell pkg-config gtk+-2.0 --cflags)
GTK_LDFLAGS=$(shell pkg-config gtk+-2.0 --libs)

CFLAGS+=$(GTK_CFLAGS)
LDFLAGS+=$(GTK_LDFLAGS)

ifneq ($(CONFIG_LFS),)
  CFLAGS+=$(shell getconf LFS_CFLAGS)
endif

OBJS=beer.o msgbox.o main.o io.o send.o saft.o gutils.o receive.o options.o

ifeq ($(shell whoami),root)
install=install -o root -g root
else
install=install
endif

beer: $(OBJS)

install: beer
	test -d $(prefix)/bin || $(install) -d -g root -o root -m 755 $(prefix)/bin
	$(install) -s -m 755 beer $(prefix)/bin

clean:
	rm -f $(OBJS) core beer
