1 # Copyright (C) 1999-2009 Free Software Foundation, Inc.
3 # This file is part of GNU gengetopt
5 # GNU gengetopt is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
10 # GNU gengetopt is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 # Public License for more details.
15 # You should have received a copy of the GNU General Public License along
16 # with gengetopt; see the file COPYING. If not, write to the Free Software
17 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 SUBDIRS = includes skels tests
21 #INCLUDES = -I@top_srcdir@/src/skels
23 SUFFIXES = .text .c .ggo
28 bin_PROGRAMS = gengetopt
30 noinst_LTLIBRARIES = libgengetopt.la
32 libgengetopt_la_SOURCES = parser.cc scanner.cc \
34 argsdef.c cmdline.ggo gm.cc \
35 yyerror.cc gm_utils.cpp fileutils.cpp acceptedvalues.cpp ggos.cpp
37 gengetopt_SOURCES = gengetopt.cc
39 scanner.cc: $(srcdir)/scanner.ll
40 $(LEX) $(LFLAGS) -o $(srcdir)/scanner.cc $(srcdir)/scanner.ll
42 parser.cc: $(srcdir)/parser.yy
43 $(YACC) -o $(srcdir)/parser.cc $(srcdir)/parser.yy --defines=$(srcdir)/parser.h
45 #gengetopt_LDADD = @LIBOBJS@ @LEXLIB@ skels/libgen.a
47 # these are for gnulib
48 AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl
50 libgengetopt_la_LIBADD = $(top_builddir)/gl/libgnu.la \
54 LDADD = $(top_builddir)/src/libgengetopt.la
56 EXTRA_DIST = parser.h argsdef.h gengetopt.h ggos.h gm.h gnugetopt.h \
57 cmdline.c cmdline.h my_sstream.h my_string.h my_map.h \
61 parser.yy scanner.ll \
65 # version of gengetopt linked to the ElectricFence library
66 # don't use it anymore: use valgrind
67 #EXTRA_PROGRAMS = gengetopt-efence
68 #gengetopt_efence_SOURCES = $(gengetopt_SOURCES)
69 #gengetopt_efence_LDADD = -lefence $(gengetopt_LDADD)
71 PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT)
73 # to have flex generate a case insensitive scanner
76 # it may happen, usually if the sources have been downloaded from CVS
77 # repository, that cmdline.ggo is more recent than cmdline.c, but
78 # cmdline.c cannot be re-generated, even because gengetopt has
79 # to be built first. For instance if you only change spaces in cmdline.ggo
80 # cmdline.c will not be different, and thus it is not updated in the CVS
81 # repository; then when you make a checkout on another place, make
82 # would try to build cmdline.c, but to do this it would need gengetopt
83 # which is not built yet; so we simply touch cmdline.c (and this is safe)
86 if test -f $(PROGNAME); then \
87 $(PROGNAME) --input=$< --output-dir=$(srcdir) ; \
88 else touch $(srcdir)/$@ ; fi
92 BUILT_SOURCES = cmdline.h cmdline.c parser.cc scanner.cc
94 # automatically generate gengetopt_strdup() from the replacement function
96 # gengetopt_strdup.text: strdup.c
97 # echo "/* gengetopt_strdup(): automatically generated from strdup.c. */" > $@
98 # cat strdup.c | sed -e 's/^strdup (/gengetopt_&/' \
99 # -e 's/^char \* *$$/&/' \
100 # -e '/^#include.*$$/D' -e '/^$$/D' >> $@
102 # we distribute these files because who uses gengetopt might need them
103 # these are installed in $(prefix)/share/gengetopt
104 pkgdata_DATA = gnugetopt.h getopt.c getopt1.c
106 # yywrap.c is added only if it is not found on lex (flex) lib, and will be
107 # added automatically by automake
109 # automake (maybe due to a bug) doesn't added these files well,
110 # so we explicitely declare them
111 MAINTAINERCLEANFILES = scanner.cc parser.h parser.cc
113 noinst_HEADERS = acceptedvalues.h errorcodes.h fileutils.h \