From c43847fe14e6b32cc58b8e8168f78e72ef94316d Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Mon, 28 Jul 2014 16:20:04 +0800 Subject: autotools: Use non-recursive make With the current testing infrastructure, we don't have a strictly hierarchical set of dependencies. This causes problems with a recursive make, and means we have to hack around some of the dependencies. This change generates a single, top-level makefile from all of the Makefile.am fragments. We still need the po/ directory as a separate SUBDIR, but all others can be converted to non-recursive. Signed-off-by: Jeremy Kerr --- discover/Makefile.am | 114 +++++++++++++++++++++------------------------ discover/grub2/Makefile.am | 62 +++++++++++++----------- discover/grub2/lexer.l | 2 - 3 files changed, 90 insertions(+), 88 deletions(-) (limited to 'discover') diff --git a/discover/Makefile.am b/discover/Makefile.am index 01c29d7..9e922fe 100644 --- a/discover/Makefile.am +++ b/discover/Makefile.am @@ -12,69 +12,63 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -pkgsysconfdir = @sysconfdir@/@PACKAGE@ +sbin_PROGRAMS += discover/pb-discover -SUBDIRS = grub2 +discover_pb_discover_SOURCES = \ + discover/boot.c \ + discover/boot.h \ + discover/cdrom.c \ + discover/cdrom.h \ + discover/device-handler.c \ + discover/device-handler.h \ + discover/discover-server.c \ + discover/discover-server.h \ + discover/event.c \ + discover/event.h \ + discover/file.c \ + discover/file.h \ + discover/params.c \ + discover/params.h \ + discover/parser.c \ + discover/parser.h \ + discover/parser-conf.c \ + discover/parser-conf.h \ + discover/parser-utils.c \ + discover/parser-utils.h \ + discover/paths.c \ + discover/paths.h \ + discover/pb-discover.c \ + discover/pb-discover.h \ + discover/platform.c \ + discover/platform.h \ + discover/platform-powerpc.c \ + discover/resource.c \ + discover/resource.h \ + discover/sysinfo.c \ + discover/sysinfo.h \ + discover/network.c \ + discover/network.h \ + discover/udev.c \ + discover/udev.h \ + discover/user-event.c \ + discover/user-event.h \ + discover/kboot-parser.c \ + discover/yaboot-parser.c \ + discover/pxe-parser.c -AM_CPPFLAGS = -I$(top_srcdir)/lib \ - -DLOCALEDIR='"$(localedir)"' \ - $(DEFAULT_CPPFLAGS) - -AM_CFLAGS = $(DEFAULT_CFLAGS) \ - -DPREFIX='"$(prefix)"' \ - -DPKG_SHARE_DIR='"$(pkgdatadir)"' \ - -DPKG_SYSCONF_DIR='"$(pkgsysconfdir)"' \ - -DPKG_LIBEXEC_DIR='"$(pkglibexecdir)"' \ - -DLOCAL_STATE_DIR='"$(localstatedir)"' - -EXTRA_DIST = native-parser.c +discover_pb_discover_LDADD = \ + $(core_lib) \ + discover/grub2/grub2-parser.ro -sbin_PROGRAMS = pb-discover +discover_pb_discover_LDFLAGS = -ludev -pb_discover_SOURCES = \ - boot.c \ - boot.h \ - cdrom.c \ - cdrom.h \ - device-handler.c \ - device-handler.h \ - discover-server.c \ - discover-server.h \ - event.c \ - event.h \ - file.c \ - file.h \ - params.c \ - params.h \ - parser.c \ - parser.h \ - parser-conf.c \ - parser-conf.h \ - parser-utils.c \ - parser-utils.h \ - paths.c \ - paths.h \ - pb-discover.c \ - pb-discover.h \ - platform.c \ - platform.h \ - platform-powerpc.c \ - resource.c \ - resource.h \ - sysinfo.c \ - sysinfo.h \ - network.c \ - network.h \ - udev.c \ - udev.h \ - user-event.c \ - user-event.h \ - kboot-parser.c \ - yaboot-parser.c \ - pxe-parser.c - -pb_discover_LDADD = $(top_builddir)/lib/libpbcore.la grub2/grub2-parser.ro +discover_pb_discover_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -DLOCAL_STATE_DIR='"$(localstatedir)"' \ + -DLOCALEDIR='"$(localedir)"' \ + -DPKG_LIBEXEC_DIR='"$(pkglibexecdir)"' \ + -DPKG_SHARE_DIR='"$(pkgsharedir)"' \ + -DPKG_SYSCONF_DIR='"$(pkgsysconfdir)"' -pb_discover_LDFLAGS = -ludev +EXTRA_DIST += discover/native-parser.c -MAINTAINERCLEANFILES = Makefile.in diff --git a/discover/grub2/Makefile.am b/discover/grub2/Makefile.am index 2efc7f3..dda6835 100644 --- a/discover/grub2/Makefile.am +++ b/discover/grub2/Makefile.am @@ -12,39 +12,49 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # -AM_CPPFLAGS = -I$(top_srcdir)/lib -I$(top_srcdir) $(DEFAULT_CPPFLAGS) +noinst_PROGRAMS += discover/grub2/grub2-parser.ro -AM_CFLAGS = $(DEFAULT_CFLAGS) \ - -DPREFIX='"$(prefix)"' \ - -DPKG_SHARE_DIR='"$(pkgdatadir)"' \ - -DPKG_SYSCONF_DIR='"$(pkgsysconfdir)"' \ - -DLOCAL_STATE_DIR='"$(localstatedir)"' +discover/grub2/grub2-parser.ro$(EXEEXT): \ + $(discover_grub2_grub2_parser_ro_OBJECTS) + $(LD) -r -o $@ $^ -AM_YFLAGS = -d +discover_grub2_grub2_parser_ro_SOURCES = \ + discover/grub2/builtins.c \ + discover/grub2/env.c \ + discover/grub2/grub2.h \ + discover/grub2/grub2.c \ + discover/grub2/lexer.l \ + discover/grub2/parser.y \ + discover/grub2/script.c -noinst_PROGRAMS = grub2-parser.ro +BUILT_SOURCES += \ + discover/grub2/parser.c \ + discover/grub2/parser.h \ + discover/grub2/lexer.h \ + discover/grub2/lexer.c -grub2-parser.ro$(EXEEXT): $(grub2_parser_ro_OBJECTS) - $(LD) -r -o $@ $^ +CLEANFILES += \ + discover/grub2/parser.c \ + discover/grub2/parser.h \ + discover/grub2/lexer.c \ + discover/grub2/lexer.h -grub2_parser_ro_SOURCES = \ - builtins.c \ - env.c \ - grub2.h \ - grub2.c \ - lexer.l \ - parser.y \ - script.c \ - parser.c +discover_grub2_grub2_parser_ro_CPPFLAGS = \ + $(AM_CPPFLAGS) \ + -I$(top_srcdir)/discover/grub2 \ + -I$(top_builddir)/discover/grub2 -BUILT_SOURCES = parser.h lexer.h lexer.c lexer.h -CLEANFILES = lexer.c lexer.h -MAINTAINERCLEANFILES = Makefile.in # ylwrap doesn't handle flex header files well; use our own rule here. -lexer.h lexer.c: lexer.l - $(LEX) $(LFLAGS) --header-file=lexer.h -o lexer.c $^ +discover/grub2/lexer.h discover/grub2/lexer.c: \ + $(top_srcdir)/discover/grub2/lexer.l + $(AM_V_LEX)$(LEXCOMPILE) --header-file=discover/grub2/lexer.h \ + -o discover/grub2/lexer.c $^ + +# We need to loosen our warnings for the generated lexer code. +discover/grub2/%lexer.o discover/grub2/lexer.o: \ + AM_CFLAGS += -Wno-unused-parameter -Wno-missing-prototypes \ + -Wno-missing-declarations -lexer.o: CFLAGS+=-Wno-unused-parameter -Wno-missing-prototypes \ - -Wno-missing-declarations +$(discover_grub2_grub2_parser_ro_OBJECTS): discover/grub2/parser.h diff --git a/discover/grub2/lexer.l b/discover/grub2/lexer.l index e1aad99..e557146 100644 --- a/discover/grub2/lexer.l +++ b/discover/grub2/lexer.l @@ -17,8 +17,6 @@ void yyerror(struct grub2_parser *parser, const char *fmt, ...); %option yylineno %option noyyalloc noyyfree noyyrealloc %option extra-type="struct grub2_parser *" -%option header-file="lexer.h" -%option outfile="lexer.c" %x sqstring %x dqstring -- cgit v1.1