# Makefile for gperf

# Copyright (C) 1989, 1992-1993, 1998, 2012, 2016, 2018, 2020, 2022, 2024 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.
#
# 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 <https://www.gnu.org/licenses/>.

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

# Directories used by "make":
srcdir = @srcdir@

# Programs used by "make":
RM = rm -f
@SET_MAKE@

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

SHELL = /bin/sh

VPATH = $(srcdir)

all : force
	cd @subdir@; $(MAKE) all

install : force
	cd @subdir@; $(MAKE) install

installdirs : force
	cd @subdir@; $(MAKE) installdirs

uninstall : force
	cd @subdir@; $(MAKE) uninstall

check : force
	cd @subdir@; $(MAKE) check

mostlyclean : force
	cd @subdir@; $(MAKE) mostlyclean

clean : force
	cd @subdir@; $(MAKE) clean

distclean : force
	cd @subdir@; if test -f Makefile; then $(MAKE) distclean; fi
	$(RM) config.status config.log config.cache Makefile

maintainer-clean : force
	cd @subdir@; if test -f Makefile; then $(MAKE) maintainer-clean; fi
	$(RM) config.status config.log config.cache Makefile

# List of source files.
SOURCE_FILES = \
  README INSTALL.windows NEWS AUTHORS JOIN-GNU \
  autogen.sh configure.ac aclocal.m4 Makefile.in \
  Makefile.devel ChangeLog
# List of distributed files imported from other packages.
IMPORTED_FILES = \
  COPYING INSTALL \
  build-aux/install-sh build-aux/mkinstalldirs \
  build-aux/compile build-aux/ar-lib \
  lib/filename.h
# List of distributed files generated by autotools or Makefile.devel.
GENERATED_FILES = configure
# List of distributed files generated by "make".
DISTRIBUTED_BUILT_FILES =
# List of distributed files.
DISTFILES = $(SOURCE_FILES) $(IMPORTED_FILES) $(GENERATED_FILES) $(DISTRIBUTED_BUILT_FILES)

distdir : $(DISTFILES)
	for file in $(DISTFILES); do \
	  if test -f $$file; then dir='.'; else dir='$(srcdir)'; fi; \
	  destdir=`echo '$(distdir)'/$$file | sed -e 's|//*[^/]*$$||'`; \
	  test -d "$$destdir" || mkdir "$$destdir"; \
	  cp -p $$dir/$$file '$(distdir)'/$$file || exit 1; \
	done
	subdir=@subdir@; test -d '$(distdir)'/$$subdir || mkdir '$(distdir)'/$$subdir; cd $$subdir; $(MAKE) distdir distdir='$(distdir)'/$$subdir

# Creating a distribution tarball.
PACKAGE = gperf
VERSION = `sed -n -e 's/.*version_string = "\(.*\)".*/\1/p' < $(srcdir)/src/version.cc`
TAR = tar
GZIP = gzip

dist : force
	tmpdistdir=$(PACKAGE)-$(VERSION); \
	abstmpdistdir=`pwd`/$$tmpdistdir; \
	rm -rf $$tmpdistdir $$tmpdistdir.tar $$tmpdistdir.tar.gz \
	  && mkdir $$tmpdistdir \
	  && $(MAKE) distdir distdir="$$abstmpdistdir" \
	  && $(TAR) chof $$tmpdistdir.tar --owner=root --group=root $$tmpdistdir \
	  && $(GZIP) -9 $$tmpdistdir.tar \
	  && rm -rf $$tmpdistdir

# Ensure that the manual page is up-to-date when "make dist" runs.
dist : doc/gperf.1
doc/gperf.1: $(srcdir)/src/options.cc
	cd lib && $(MAKE)
	cd src && $(MAKE) gperf$(EXEEXT)
	cd doc && $(MAKE) gperf.1

force :

