[osinfo-db-tools PATCH v2 13/16] Support `make syntax-check` without Makefile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A few dirty hacks have been done in GNUmakefile, cfg.mk, and maint.mk
in order to support running `make syntax-check` without having to have a
Makefile around.

GNUmakefile: set srcdir & top_srcdir and remove the parts that would
cause an error due to no presence of a Makefile.

cfg.mk: add sc_prohibit_always-defined_macros to the list of local
checks to skip as it looks for Makefile, which is generated after
running ./configure.

maint.mk: allow running `make syntax-check` without having a Makefile
generated.

Signed-off-by: Fabiano Fidêncio <fidencio@xxxxxxxxxx>
---
 GNUmakefile | 28 ++--------------------------
 cfg.mk      |  3 ++-
 maint.mk    |  2 --
 3 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/GNUmakefile b/GNUmakefile
index ca88b6b..a62b880 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -30,10 +30,8 @@ else
 SHELL = sh
 endif
 
-# If the user runs GNU make but has not yet run ./configure,
-# give them a diagnostic.
-_have-Makefile := $(shell test -f Makefile && echo yes)
-ifeq ($(_have-Makefile),yes)
+srcdir = .
+top_srcdir = .
 
 # Make tar archive easier to reproduce.
 export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
@@ -41,8 +39,6 @@ export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner
 # Allow the user to add to this in the Makefile.
 ALL_RECURSIVE_TARGETS =
 
-include Makefile
-
 # Some projects override e.g., _autoreconf here.
 -include $(srcdir)/cfg.mk
 
@@ -94,26 +90,6 @@ _version:
 	cd $(srcdir) && rm -rf autom4te.cache .version && $(_autoreconf)
 	$(MAKE) $(AM_MAKEFLAGS) Makefile
 
-else
-
-.DEFAULT_GOAL := abort-due-to-no-makefile
-srcdir = .
-
-# The package can override .DEFAULT_GOAL to run actions like autoreconf.
--include ./cfg.mk
-include ./maint.mk
-
-ifeq ($(.DEFAULT_GOAL),abort-due-to-no-makefile)
-$(MAKECMDGOALS): abort-due-to-no-makefile
-endif
-
-abort-due-to-no-makefile:
-	@echo There seems to be no Makefile in this directory.   1>&2
-	@echo "You must run ./configure before running \`make'." 1>&2
-	@exit 1
-
-endif
-
 # Tell version 3.79 and up of GNU make to not build goals in this
 # directory in parallel, in case someone tries to build multiple
 # targets, and one of them can cause a recursive target to be invoked.
diff --git a/cfg.mk b/cfg.mk
index 84ca1cd..8f41450 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -35,7 +35,8 @@ local-checks-to-skip =			\
   sc_program_name			\
   sc_makefile_check			\
   sc_require_config_h			\
-  sc_require_config_h_first
+  sc_require_config_h_first		\
+  sc_prohibit_always-defined_macros
 
 # Files that should never cause syntax check failures.
 VC_LIST_ALWAYS_EXCLUDE_REGEX = \
diff --git a/maint.mk b/maint.mk
index 16e9360..b8c207d 100644
--- a/maint.mk
+++ b/maint.mk
@@ -159,7 +159,6 @@ export LC_ALL = C
 ## Sanity checks.  ##
 ## --------------- ##
 
-ifneq ($(_gl-Makefile),)
 _cfg_mk := $(wildcard $(srcdir)/cfg.mk)
 
 # Collect the names of rules starting with 'sc_'.
@@ -201,7 +200,6 @@ local-check :=								\
     $(filter-out $(local-checks-to-skip), $(local-checks-available)))
 
 syntax-check: $(local-check)
-endif
 
 # _sc_search_regexp
 #
-- 
2.21.0

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux