xref: /netbsd-src/external/bsd/flex/dist/Makefile.am (revision 1897181a7231d5fc7ab48994d1447fcbc4e13a49)
1# This file is part of flex.
2
3# Redistribution and use in source and binary forms, with or without
4# modification, are permitted provided that the following conditions
5# are met:
6
7# 1. Redistributions of source code must retain the above copyright
8#    notice, this list of conditions and the following disclaimer.
9# 2. Redistributions in binary form must reproduce the above copyright
10#    notice, this list of conditions and the following disclaimer in the
11#    documentation and/or other materials provided with the distribution.
12
13# Neither the name of the University nor the names of its contributors
14# may be used to endorse or promote products derived from this software
15# without specific prior written permission.
16
17# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
18# IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
19# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20# PURPOSE.
21
22# Notes on building:
23
24# Possible values for DEFS:
25#
26# By default, flex generates 8-bit scanners when using table compression,
27# and 7-bit scanners when using uncompressed tables (-f or -F options).
28# For flex to always generate 8-bit scanners, add "-DDEFAULT_CSIZE=256"
29# to DEFS.
30#
31# For Vax/VMS, add "-DVMS" to DEFS.
32#
33# For MS-DOS, add "-DMS_DOS" to DEFS.  See the directory MISC/MSDOS for
34# additional info.
35
36AM_YFLAGS = -d
37ACLOCAL_AMFLAGS = -I m4
38m4 = @M4@
39indent = @INDENT@
40
41bin_PROGRAMS = flex
42lib_LIBRARIES = \
43	libfl.a \
44	libfl_pic.a
45
46flex_SOURCES = \
47	ccl.c \
48	dfa.c \
49	ecs.c \
50	scanflags.c \
51	gen.c \
52	main.c \
53	misc.c \
54	nfa.c \
55	parse.y \
56	scan.l \
57	skel.c \
58	sym.c \
59	tblcmp.c \
60	yylex.c \
61	options.c \
62	scanopt.c \
63	buf.c \
64	tables.c \
65	tables_shared.c \
66	filter.c \
67	regex.c
68
69libfl_a_SOURCES = \
70	libmain.c \
71	libyywrap.c
72
73libfl_pic_a_SOURCES = \
74	libmain.c \
75	libyywrap.c
76
77libfl_pic_a_CFLAGS =  \
78	-fPIC         \
79	$(AM_CFLAGS)
80
81noinst_HEADERS = \
82	flexdef.h \
83	flexint.h \
84	version.h \
85	options.h \
86	scanopt.h \
87	tables.h \
88	tables_shared.h
89
90include_HEADERS = \
91	FlexLexer.h
92
93EXTRA_DIST = \
94	.indent.pro \
95	AUTHORS \
96	COPYING \
97	INSTALL \
98	NEWS \
99	ONEWS \
100	README \
101	README.cvs \
102	THANKS \
103	TODO \
104	autogen.sh \
105	flex.skl \
106	mkskel.sh \
107	ABOUT-NLS \
108	config.rpath \
109	gettext.h
110
111BUILT_SOURCES = \
112	skel.c
113
114SUBDIRS = \
115	. \
116	doc \
117	m4  \
118	examples \
119	po \
120	tools \
121	tests
122
123localedir = $(datadir)/locale
124AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
125LIBS = @LIBINTL@ @LIBS@
126
127skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
128	sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | $(m4) -P -DFLEX_MAJOR_VERSION=`echo $(VERSION)|cut -f 1 -d .` -DFLEX_MINOR_VERSION=`echo $(VERSION)|cut -f 2 -d .` -DFLEX_SUBMINOR_VERSION=`echo $(VERSION)|cut -f 3 -d .` | sed 's/m4postproc_/m4_/g' | $(SHELL) $(srcdir)/mkskel.sh  >skel.c
129
130# Explicitly describe dependencies.
131# You can recreate this with `gcc -I. -MM *.c'
132buf.o: buf.c flexdef.h flexint.h
133ccl.o: ccl.c flexdef.h flexint.h
134dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
135ecs.o: ecs.c flexdef.h flexint.h
136scanflags.o: scanflags.c flexdef.h flexint.h
137gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
138libmain.o: libmain.c
139libyywrap.o: libyywrap.c
140main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
141 tables.h tables_shared.h
142misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
143nfa.o: nfa.c flexdef.h flexint.h
144options.o: options.c options.h scanopt.h flexdef.h flexint.h
145parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
146scan.o: scan.c flexdef.h flexint.h parse.h
147scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
148skel.o: skel.c flexdef.h flexint.h
149sym.o: sym.c flexdef.h flexint.h
150tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
151tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
152 tables_shared.h
153tblcmp.o: tblcmp.c flexdef.h flexint.h
154yylex.o: yylex.c flexdef.h flexint.h parse.h
155filter.o: filter.c flexdef.h flexint.h
156
157# Create the ChangeLog, but only if we're inside a cvs working directory
158
159ChangeLog: $(srcdir)/tools/cvsauthors $(srcdir)/tools/cvs2cl.pl
160	if [ -d CVS ] ; then \
161		sh $(srcdir)/tools/cvs2cl.pl -F trunk -U $(srcdir)/tools/cvsauthors \
162	; fi
163
164# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
165#
166# Whole idea:
167#   1. Check for .indent.pro, otherwise indent will use unknown
168#      settings, or worse, the GNU defaults.)
169#   2. Check that this is GNU indent.
170#   3. Make sure to process only the NON-generated .c and .h files.
171#   4. Run indent twice per file. The first time is a test.
172#      Otherwise, indent overwrites your file even if it fails!
173indentfiles = \
174	buf.c \
175	ccl.c \
176	dfa.c \
177	ecs.c \
178	scanflags.c \
179	filter.c \
180	flexdef.h \
181	gen.c \
182	libmain.c \
183	libyywrap.c \
184	main.c \
185	misc.c \
186	nfa.c \
187	options.c \
188	options.h \
189	regex.c \
190	scanopt.c \
191	scanopt.h \
192	sym.c \
193	tables.c \
194	tables.h \
195	tables_shared.c \
196	tables_shared.h \
197	tblcmp.c
198
199indent:
200	if [ -f .indent.pro ] ; then \
201	for f in $(indentfiles);\
202	do\
203		echo indenting $$f ;\
204		$(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
205	done \
206	fi
207
208.PHONY: ChangeLog tags indent
209