summaryrefslogtreecommitdiff
path: root/src/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'src/Makefile.am')
-rw-r--r--src/Makefile.am162
1 files changed, 83 insertions, 79 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 416995e..e379692 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,68 +1,83 @@
AM_YFLAGS = -d
-localedir = $(datadir)/locale
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\"
LIBS = @LIBS@
m4 = @M4@
bin_PROGRAMS = flex
+if ENABLE_BOOTSTRAP
noinst_PROGRAMS = stage1flex
-lib_LTLIBRARIES = \
- libfl.la \
- libfl_pic.la
+endif
+
+if ENABLE_LIBFL
+lib_LTLIBRARIES = libfl.la
+endif
+libfl_la_SOURCES = \
+ libmain.c \
+ libyywrap.c
+libfl_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
stage1flex_SOURCES = \
scan.l \
$(COMMON_SOURCES)
+if CROSS
+stage1flex_LDADD =
+stage1flex_SOURCES += \
+ ../lib/malloc.c \
+ ../lib/realloc.c
+stage1flex_LINK = $(LIBTOOL) --tag=CC --mode=link $(CC_FOR_BUILD) \
+ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) -o $@
+
+$(stage1flex_OBJECTS): CC=$(CC_FOR_BUILD)
+$(stage1flex_OBJECTS): CFLAGS=$(CFLAGS_FOR_BUILD)
+$(stage1flex_OBJECTS): CPP=$(CPP_FOR_BUILD)
+$(stage1flex_OBJECTS): CPPFLAGS=$(CPPFLAGS_FOR_BUILD)
+$(stage1flex_OBJECTS): LDFLAGS=$(LDFLAGS_FOR_BUILD)
+else
+stage1flex_LDADD = $(LDADD)
+stage1flex_LINK = $(LINK)
+stage1flex_CFLAGS = $(AM_CFLAGS)
+endif
+
flex_SOURCES = \
- stage1scan.l \
$(COMMON_SOURCES)
+nodist_flex_SOURCES = \
+ stage1scan.c
+
+flex_CFLAGS = $(AM_CFLAGS) $(WARNINGFLAGS)
+
COMMON_SOURCES = \
buf.c \
ccl.c \
dfa.c \
ecs.c \
filter.c \
+ flexdef.h \
+ flexint.h \
gen.c \
main.c \
misc.c \
nfa.c \
options.c \
+ options.h \
parse.y \
regex.c \
scanflags.c \
scanopt.c \
+ scanopt.h \
skel.c \
sym.c \
tables.c \
+ tables.h \
tables_shared.c \
+ tables_shared.h \
tblcmp.c \
+ version.h \
yylex.c
-LDADD = ../lib/libcompat.la @LIBINTL@
-
-libfl_la_SOURCES = \
- libmain.c \
- libyywrap.c
-
-libfl_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
-
-libfl_pic_la_SOURCES = \
- libmain.c \
- libyywrap.c
-
-libfl_pic_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
-
-noinst_HEADERS = \
- flexdef.h \
- flexint.h \
- version.h \
- options.h \
- scanopt.h \
- tables.h \
- tables_shared.h
+LDADD = $(LIBOBJS) @LIBINTL@
include_HEADERS = \
FlexLexer.h
@@ -72,52 +87,38 @@ EXTRA_DIST = \
mkskel.sh \
gettext.h
-DISTCLEANFILES = stage1scan.c
+CLEANFILES = stage1scan.c stage1flex$(EXEEXT)
MAINTAINERCLEANFILES = skel.c
-$(srcdir)/skel.c: flex.skl mkskel.sh flexint.h tables_shared.h
- sed 's/m4_/m4postproc_/g; s/m4preproc_/m4_/g' $(srcdir)/flex.skl | \
- $(m4) -P -I $(srcdir) \
- -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.tmp
- mv skel.c.tmp $(srcdir)/skel.c
-
-stage1scan.l: scan.l
- cp $(srcdir)/scan.l $(srcdir)/stage1scan.l
-
-stage1scan.c: stage1scan.l stage1flex$(EXEEXT)
- $(top_builddir)/src/stage1flex$(EXEEXT) -o $@ $<
-
-# Explicitly describe dependencies.
-# You can recreate this with `gcc -I. -MM *.c'
-buf.o: buf.c flexdef.h flexint.h
-ccl.o: ccl.c flexdef.h flexint.h
-dfa.o: dfa.c flexdef.h flexint.h tables.h tables_shared.h
-ecs.o: ecs.c flexdef.h flexint.h
-scanflags.o: scanflags.c flexdef.h flexint.h
-gen.o: gen.c flexdef.h flexint.h tables.h tables_shared.h
-libmain.o: libmain.c
-libyywrap.o: libyywrap.c
-main.o: main.c flexdef.h flexint.h version.h options.h scanopt.h \
- tables.h tables_shared.h
-misc.o: misc.c flexdef.h flexint.h tables.h tables_shared.h
-nfa.o: nfa.c flexdef.h flexint.h
-options.o: options.c options.h scanopt.h flexdef.h flexint.h
-parse.o: parse.c flexdef.h flexint.h tables.h tables_shared.h
-scan.o: scan.c flexdef.h flexint.h parse.h
-scanopt.o: scanopt.c flexdef.h flexint.h scanopt.h
-skel.o: skel.c flexdef.h flexint.h
-sym.o: sym.c flexdef.h flexint.h
-tables.o: tables.c flexdef.h flexint.h tables.h tables_shared.h
-tables_shared.o: tables_shared.c flexdef.h flexint.h tables.h \
- tables_shared.h
-tblcmp.o: tblcmp.c flexdef.h flexint.h
-yylex.o: yylex.c flexdef.h flexint.h parse.h
-filter.o: filter.c flexdef.h flexint.h
+skel.c: flex.skl mkskel.sh flexint.h tables_shared.h tables_shared.c
+ $(SHELL) $(srcdir)/mkskel.sh $(srcdir) $(m4) $(VERSION) > $@.tmp
+ mv $@.tmp $@
+
+if ENABLE_BOOTSTRAP
+stage1scan.c: scan.l stage1flex$(EXEEXT)
+ ./stage1flex$(EXEEXT) $(AM_LFLAGS) $(LFLAGS) -o $@ $(srcdir)/scan.l
+else
+stage1scan.c: scan.c
+ sed 's|^\(#line .*\)"'`printf %s $< | sed 's|[][\\\\.*]|\\\\&|g'`'"|\1"$@"|g' $< > $@
+endif
+
+dist-hook: scan.l flex$(EXEEXT)
+ chmod u+w $(distdir)/scan.c && \
+ ./flex$(EXEEXT) -o scan.c $< && \
+ mv scan.c $(distdir)
+
+# make needs to be told to make parse.h so that parallelized runs will
+# not fail.
+
+stage1flex-main.$(OBJEXT): parse.h
+flex-main.$(OBJEXT): parse.h
+
+stage1flex-yylex.$(OBJEXT): parse.h
+flex-yylex.$(OBJEXT): parse.h
+
+stage1flex-scan.$(OBJEXT): parse.h
+flex-stage1scan.$(OBJEXT): parse.h
# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
#
@@ -154,11 +155,14 @@ indentfiles = \
tables_shared.h \
tblcmp.c
-indent:
- if [ -f .indent.pro ] ; then \
- for f in $(indentfiles);\
- do\
- echo indenting $$f ;\
- $(indent) < $$f >/dev/null && indent $$f || echo $$f FAILED to indent ;\
- done \
- fi
+indent: $(top_srcdir)/.indent.pro
+ cd $(top_srcdir) && \
+ for f in $(indentfiles); do \
+ f=src/$$f; \
+ echo indenting $$f; \
+ INDENT_PROFILE=.indent.pro $(INDENT) <$$f >/dev/null && \
+ INDENT_PROFILE=.indent.pro $(INDENT) $$f || \
+ echo $$f FAILED to indent; \
+ done;
+
+.PHONY: indent