]> Creatis software - clitk.git/blob - utilities/gengetopt/Makefile.am
Sync gengetopt cmake files with rtk
[clitk.git] / utilities / gengetopt / Makefile.am
1 # Copyright (C) 1999-2009  Free Software Foundation, Inc.
2 #  
3 # This file is part of GNU gengetopt 
4 #
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) 
8 # any later version. 
9 #
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. 
14 #
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. 
18
19 SUBDIRS = includes skels tests
20
21 #INCLUDES = -I@top_srcdir@/src/skels
22
23 SUFFIXES = .text .c .ggo
24
25 .text.o:
26         $(TXTC) $<
27
28 bin_PROGRAMS = gengetopt
29
30 noinst_LTLIBRARIES = libgengetopt.la
31
32 libgengetopt_la_SOURCES = parser.cc scanner.cc \
33 globals.cpp \
34 argsdef.c cmdline.ggo gm.cc \
35 yyerror.cc gm_utils.cpp fileutils.cpp acceptedvalues.cpp ggos.cpp
36
37 gengetopt_SOURCES = gengetopt.cc
38
39 scanner.cc: $(srcdir)/scanner.ll
40         $(LEX) $(LFLAGS) -o $(srcdir)/scanner.cc $(srcdir)/scanner.ll
41
42 parser.cc: $(srcdir)/parser.yy
43         $(YACC) -o $(srcdir)/parser.cc $(srcdir)/parser.yy --defines=$(srcdir)/parser.h
44
45 #gengetopt_LDADD = @LIBOBJS@ @LEXLIB@ skels/libgen.a
46
47 # these are for gnulib
48 AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_builddir)/gl
49
50 libgengetopt_la_LIBADD = $(top_builddir)/gl/libgnu.la \
51         @LTLIBOBJS@ \
52         skels/libgen.la
53
54 LDADD = $(top_builddir)/src/libgengetopt.la
55
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 \
58 global_opts.h \
59 ggo_options.h \
60 groups.h \
61 parser.yy scanner.ll \
62 globals.h \
63 $(pkgdata_DATA)
64
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)
70
71 PROGNAME = $(top_builddir)/src/gengetopt$(EXEEXT)
72
73 # to have flex generate a case insensitive scanner
74 AM_LFLAGS = -i
75
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)
84
85 .ggo.c:
86         if test -f $(PROGNAME); then \
87         $(PROGNAME) --input=$< --output-dir=$(srcdir) ; \
88         else touch $(srcdir)/$@ ; fi
89
90 cmdline.h: cmdline.c
91
92 BUILT_SOURCES = cmdline.h cmdline.c parser.cc scanner.cc
93
94 # automatically generate gengetopt_strdup() from the replacement function
95 # strdup().
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' >> $@
101
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
105
106 # yywrap.c is added only if it is not found on lex (flex) lib, and will be
107 # added automatically by automake
108
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 
112
113 noinst_HEADERS = acceptedvalues.h errorcodes.h fileutils.h \
114         gm_utils.h yyerror.h
115