# Makefile for gperf/src

# Copyright (C) 1989, 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc.
# Written by Douglas C. Schmidt <schmidt@ics.uci.edu>
# and Bruno Haible <bruno@clisp.org>.
#
# This file is part of GNU GPERF.
#
# GNU GPERF 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, or (at your option)
# any later version.
#
# GNU GPERF 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; see the file COPYING.
# If not, write to the Free Software Foundation, Inc.,
# 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#### Start of system configuration section. ####

# Directories used by "make":
srcdir = ../../gperf-3.0.1-src/src

# Directories used by "make install":
prefix = c:/progra~1/Gperf
local_prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
resdir = ../res

# Programs used by "make":
# C compiler
CC = gcc
CFLAGS =  -Wall -O3 -fms-extensions -mms-bitfields  -fno-exceptions -fomit-frame-pointer -march=i386 -mcpu=i686  
CPP = gcc -E
# C++ compiler
CXX = g++
CXXFLAGS =   -Wall -O3 -fms-extensions -mms-bitfields  -fno-exceptions -fomit-frame-pointer -march=i386 -mcpu=i686    -fconserve-space -fno-rtti  
CXXCPP = g++ -E
# Both C and C++ compiler
LDFLAGS =  -Wl,-s -Wl,--force-exe-suffix -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc  	 -Wl,--major-image-version=$(MAJOR) -Wl,--minor-image-version=$(MINOR)
# Other
MV = mv
LN = cp -fp
RM = rm -f


# Programs used by "make install":
INSTALL = /bin/install.exe -cpD
INSTALL_PROGRAM = /bin/install.exe -cpD
INSTALL_DATA = /bin/install.exe -cp
MKINSTALLDIRS = $(SHELL) $(srcdir)/../mkinstalldirs

#### End of system configuration section. ####

VERSION=3.0.2
MAJOR=3
MINOR=0

SHELL = /bin/sh

VPATH = $(srcdir) $(resdir)

EXEEXT=.exe

OBJECTS  = gperf-res.o version.o positions.o options.o keyword.o keyword-list.o \
           input.o bool-array.o hash-table.o search.o output.o main.o
LIBS     = ../lib/libgp.a -lm
CPPFLAGS = -I. -I$(srcdir)/../lib

TARGETPROG = gperf$(EXEEXT)

all : $(TARGETPROG)

$(TARGETPROG): $(OBJECTS)
	$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LIBS)

.SUFFIXES: .c .o .rc
# Rule to make compiled resource (Windows)
.rc.o:
	windres --include-dir $(resdir) -i $< -o $@
	
# Don't use implicit rules, since AIX "make" and OSF/1 "make" don't always
# expand $< correctly in this context.
#
#%.o : %.c
#	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<
#
#%.o : %.cc
#	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $<

# Dependencies.
CONFIG_H = config.h
VERSION_H = version.h
POSITIONS_H = positions.h positions.icc
OPTIONS_H = options.h options.icc $(POSITIONS_H)
KEYWORD_H = keyword.h keyword.icc
KEYWORD_LIST_H = keyword-list.h keyword-list.icc $(KEYWORD_H)
INPUT_H = input.h $(KEYWORD_LIST_H)
BOOL_ARRAY_H = bool-array.h bool-array.icc $(OPTIONS_H)
HASH_TABLE_H = hash-table.h $(KEYWORD_H)
SEARCH_H = search.h $(KEYWORD_LIST_H) $(POSITIONS_H) $(BOOL_ARRAY_H)
OUTPUT_H = output.h $(KEYWORD_LIST_H) $(POSITIONS_H)

version.o : version.cc $(VERSION_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/version.cc
positions.o : positions.cc $(POSITIONS_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/positions.cc
options.o : options.cc $(OPTIONS_H) $(VERSION_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/options.cc
keyword.o : keyword.cc $(KEYWORD_H) $(POSITIONS_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/keyword.cc
keyword-list.o : keyword-list.cc $(KEYWORD_LIST_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/keyword-list.cc
input.o : input.cc $(INPUT_H) $(OPTIONS_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/input.cc
bool-array.o : bool-array.cc $(BOOL_ARRAY_H) $(OPTIONS_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/bool-array.cc
hash-table.o : hash-table.cc $(HASH_TABLE_H) $(OPTIONS_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash-table.cc
search.o : search.cc $(SEARCH_H) $(OPTIONS_H) $(HASH_TABLE_H) $(CONFIG_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/search.cc
output.o : output.cc $(OUTPUT_H) $(OPTIONS_H) $(VERSION_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/output.cc
main.o : main.cc $(OPTIONS_H) $(INPUT_H) $(SEARCH_H) $(OUTPUT_H)
	$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/main.cc

install : all force
	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)
	$(INSTALL_PROGRAM) $(TARGETPROG) $(DESTDIR)$(bindir)/$(TARGETPROG)

installdirs : force
	$(MKINSTALLDIRS) $(DESTDIR)$(bindir)

uninstall : force
	$(RM) $(DESTDIR)$(bindir)/$(TARGETPROG)

check : all

mostlyclean : clean

clean : force
	$(RM) *~ *.s *.o *.a $(TARGETPROG) core

distclean : clean
	$(RM) config.status config.log config.cache Makefile config.h

maintainer-clean : distclean

force :
