xref: /netbsd-src/external/bsd/flex/dist/Makefile.am (revision 80d9064ac03cbb6a4174695f0d5b237c8766d3d0)
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
69
70LDADD = lib/libcompat.a
71
72libfl_a_SOURCES = \
73	libmain.c \
74	libyywrap.c
75
76libfl_pic_a_SOURCES = \
77	libmain.c \
78	libyywrap.c
79
80libfl_pic_a_CFLAGS =  \
81	-fPIC         \
82	$(AM_CFLAGS)
83
84noinst_HEADERS = \
85	flexdef.h \
86	flexint.h \
87	version.h \
88	options.h \
89	scanopt.h \
90	tables.h \
91	tables_shared.h
92
93include_HEADERS = \
94	FlexLexer.h
95
96dist_doc_DATA = \
97	AUTHORS \
98	COPYING \
99	NEWS \
100	ONEWS \
101	README \
102	README.cvs \
103	TODO
104
105EXTRA_DIST = \
106	.indent.pro \
107	ABOUT-NLS \
108	INSTALL \
109	autogen.sh \
110	flex.skl \
111	mkskel.sh \
112	config.rpath \
113	gettext.h
114
115BUILT_SOURCES = \
116	skel.c
117
118SUBDIRS = \
119	lib \
120	. \
121	doc \
122	examples \
123	po \
124	tools \
125	tests
126
127localedir = $(datadir)/locale
128AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
129LIBS = @LIBINTL@ @LIBS@
130
131skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
132	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
133
134# Explicitly describe dependencies.
135# You can recreate this with `gcc -I. -MM *.c'
136buf.o: buf.c flexdef.h flexint.h
137ccl.o: ccl.c flexdef.h flexint.h
138dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
139ecs.o: ecs.c flexdef.h flexint.h
140scanflags.o: scanflags.c flexdef.h flexint.h
141gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
142libmain.o: libmain.c
143libyywrap.o: libyywrap.c
144main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
145 tables.h tables_shared.h
146misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
147nfa.o: nfa.c flexdef.h flexint.h
148options.o: options.c options.h scanopt.h flexdef.h flexint.h
149parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
150scan.o: scan.c flexdef.h flexint.h parse.h
151scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
152skel.o: skel.c flexdef.h flexint.h
153sym.o: sym.c flexdef.h flexint.h
154tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
155tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
156 tables_shared.h
157tblcmp.o: tblcmp.c flexdef.h flexint.h
158yylex.o: yylex.c flexdef.h flexint.h parse.h
159filter.o: filter.c flexdef.h flexint.h
160
161# Create the ChangeLog, but only if we're inside a git working directory
162
163ChangeLog: $(srcdir)/tools/git2cl
164	if [ -d $(srcdir)/.git ] ; then \
165		$(srcdir)/tools/git2cl > $@ \
166	; fi
167
168# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
169#
170# Whole idea:
171#   1. Check for .indent.pro, otherwise indent will use unknown
172#      settings, or worse, the GNU defaults.)
173#   2. Check that this is GNU indent.
174#   3. Make sure to process only the NON-generated .c and .h files.
175#   4. Run indent twice per file. The first time is a test.
176#      Otherwise, indent overwrites your file even if it fails!
177indentfiles = \
178	buf.c \
179	ccl.c \
180	dfa.c \
181	ecs.c \
182	scanflags.c \
183	filter.c \
184	flexdef.h \
185	gen.c \
186	libmain.c \
187	libyywrap.c \
188	main.c \
189	misc.c \
190	nfa.c \
191	options.c \
192	options.h \
193	regex.c \
194	scanopt.c \
195	scanopt.h \
196	sym.c \
197	tables.c \
198	tables.h \
199	tables_shared.c \
200	tables_shared.h \
201	tblcmp.c
202
203indent:
204	if [ -f .indent.pro ] ; then \
205	for f in $(indentfiles);\
206	do\
207		echo indenting $$f ;\
208		$(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
209	done \
210	fi
211
212install-exec-hook:
213	cd $(DESTDIR)/$(bindir) && \
214		$(LN_S) -f flex$(EXEEXT) flex++$(EXEEXT)
215
216.PHONY: ChangeLog tags indent
217