#
# Program:    R   A   C
#
# RAC - Rows and Columns, the text extraction tool 
# http://aurelio.net/rac
#
# Copyright 2003  Aurelio Marinho Jargas
#                 Thobias Salazar Trevisan
#
# Please address all bugs and comments to:
#     verde@aurelio.net
#     thobias@thobias.org
#
#   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, version 2.
#
#   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 have received a copy of the GNU General Public License along
#   with this program, on the COPYING file.
#

use_debug1 = 
use_debug2 = 
use_debug3 = 

PROGRAM_NAME	= rac
TARGET 			= /usr/bin
MANPAGE_TARGET 	= /usr/share/man/pt_BR/man1
CC 				= gcc

CFLAGS = -Wall -O3 -Werror -pedantic -funroll-loops -fomit-frame-pointer \
			-pipe -fPIC -D_GNU_SOURCE

# DEBUG flags
DFLAGS = -Wall -g -pipe -fPIC -D_GNU_SOURCE

ifeq ($(use_debug1),yes)
CFLAGS += -DDEBUG1 -g
endif

ifeq ($(use_debug2),yes)
CFLAGS += -DDEBUG2
endif

ifeq ($(use_debug3),yes)
CFLAGS += -DDEBUG3
endif

all: $(PROGRAM_NAME)

$(PROGRAM_NAME):  $(PROGRAM_NAME).c
	$(CC) $(CFLAGS) -o $(PROGRAM_NAME) $(PROGRAM_NAME).c
	strip --strip-all $(PROGRAM_NAME)

debug: $(PROGRAM_NAME).c
	$(CC) $(DFLAGS) -o $(PROGRAM_NAME) $(PROGRAM_NAME).c

clean:
	rm -f $(PROGRAM_NAME) $(PROGRAM_NAME).tgz

install:
	cp $(PROGRAM_NAME) $(TARGET)
	cp doc/$(PROGRAM_NAME).1 $(MANPAGE_TARGET)

uninstall:
	rm -f $(TARGET)/$(PROGRAM_NAME)
	rm -f $(MANPAGE_TARGET)/$(PROGRAM_NAME).1

tar:
	tar -zcvf $(PROGRAM_NAME).tgz Makefile $(PROGRAM_NAME).{c,h}

.PHONY: clean all debug install uninstall

