From 3ba12ff9ba5ebcb55c1e3a8c720e265fa05888b2 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Thu, 10 Oct 2019 13:52:22 -0400 Subject: [PATCH 47/86] Move our infrastructure makefiles out of the topdir. No sense in leaving all this cluttering up what's usually my working directory... Signed-off-by: Peter Jones --- Makefile | 22 ++++++++++---------- docs/Makefile | 11 +++++----- src/Android.mk | 2 +- src/Makefile | 11 +++++----- Make.coverity => src/include/coverity.mk | 0 Make.defaults => src/include/defaults.mk | 2 +- Make.deprecated => src/include/deprecated.mk | 0 src/{Make.deps => include/deps.mk} | 7 +++---- gcc.specs => src/include/gcc.specs | 0 Make.rules => src/include/rules.mk | 2 +- Make.scan-build => src/include/scan-build.mk | 0 Make.version => src/include/version.mk | 0 src/test/Makefile | 7 +++---- tests/Makefile | 3 +-- 14 files changed, 31 insertions(+), 36 deletions(-) rename Make.coverity => src/include/coverity.mk (100%) rename Make.defaults => src/include/defaults.mk (97%) rename Make.deprecated => src/include/deprecated.mk (100%) rename src/{Make.deps => include/deps.mk} (65%) rename gcc.specs => src/include/gcc.specs (100%) rename Make.rules => src/include/rules.mk (98%) rename Make.scan-build => src/include/scan-build.mk (100%) rename Make.version => src/include/version.mk (100%) diff --git a/Makefile b/Makefile index 61b79a60369..7a4ac8c62e4 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,15 @@ -TOPDIR = $(shell echo $$PWD) +export TOPDIR = $(realpath $(dir $(firstword $(MAKEFILE_LIST)))) -include $(TOPDIR)/Make.deprecated -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults -include $(TOPDIR)/Make.coverity -include $(TOPDIR)/Make.scan-build +include $(TOPDIR)/src/include/deprecated.mk +include $(TOPDIR)/src/include/version.mk +include $(TOPDIR)/src/include/rules.mk +include $(TOPDIR)/src/include/defaults.mk +include $(TOPDIR)/src/include/coverity.mk +include $(TOPDIR)/src/include/scan-build.mk SUBDIRS := src docs -all : | efivar.spec Make.version +all : | efivar.spec src/include/version.mk all : @set -e ; for x in $(SUBDIRS) ; do \ $(MAKE) -C $$x $@ ; \ @@ -43,7 +43,7 @@ a : GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))") -efivar.spec : | Makefile Make.version +efivar.spec : | Makefile src/include/version.mk clean : @set -e ; for x in $(SUBDIRS) ; do \ @@ -66,8 +66,8 @@ test-archive: abicheck efivar.spec @echo "The archive is in efivar-$(GITTAG).tar.bz2" bumpver : - @echo VERSION=$(GITTAG) > Make.version - @git add Make.version + @echo VERSION=$(GITTAG) > src/include/version.mk + @git add src/include/version.mk git commit -m "Bump version to $(GITTAG)" -s tag: diff --git a/docs/Makefile b/docs/Makefile index 0f610d9d9a9..2f6fc89b694 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,10 +1,9 @@ SRCDIR = $(realpath .) -TOPDIR = $(realpath ..) -include $(TOPDIR)/Make.deprecated -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults +include $(TOPDIR)/src/include/deprecated.mk +include $(TOPDIR)/src/include/version.mk +include $(TOPDIR)/src/include/rules.mk +include $(TOPDIR)/src/include/defaults.mk MAN1TARGETS = efivar.1 MAN3TARGETS = efi_append_variable.3 \ @@ -51,4 +50,4 @@ install : .PHONY: all clean install -include $(TOPDIR)/Make.rules +include $(TOPDIR)/src/include/rules.mk diff --git a/src/Android.mk b/src/Android.mk index bf6cfb2e91b..ea6ee3f9432 100644 --- a/src/Android.mk +++ b/src/Android.mk @@ -46,7 +46,7 @@ LIBEFIVAR_SOURCES := \ lib.c \ vars.c -include $(LOCAL_PATH)/../Make.version +include $(LOCAL_PATH)/../version.mk LOCAL_SRC_FILES := $(LIBEFIBOOT_SOURCES) $(LIBEFIVAR_SOURCES) LOCAL_CFLAGS := -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -std=gnu11 -DLIBEFIVAR_VERSION=$(VERSION) diff --git a/src/Makefile b/src/Makefile index 253d1f1d56c..e5f10d4c7bf 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,10 +1,9 @@ SRCDIR = $(realpath .) -TOPDIR = $(realpath ..) -include $(TOPDIR)/Make.deprecated -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults +include $(TOPDIR)/src/include/deprecated.mk +include $(TOPDIR)/src/include/version.mk +include $(TOPDIR)/src/include/rules.mk +include $(TOPDIR)/src/include/defaults.mk LIBTARGETS=libefivar.so libefiboot.so STATICLIBTARGETS=libefivar.a libefiboot.a @@ -84,7 +83,7 @@ libefiboot.so : LIBS=efivar libefiboot.so : MAP=libefiboot.map deps : $(ALL_SOURCES) - @$(MAKE) -f $(SRCDIR)/Make.deps deps SOURCES="$(ALL_SOURCES)" + @$(MAKE) -f $(SRCDIR)/include/deps.mk deps SOURCES="$(ALL_SOURCES)" clean : @rm -rfv *~ *.o *.a *.E *.so *.so.* *.pc *.bin .*.d *.map \ diff --git a/Make.coverity b/src/include/coverity.mk similarity index 100% rename from Make.coverity rename to src/include/coverity.mk diff --git a/Make.defaults b/src/include/defaults.mk similarity index 97% rename from Make.defaults rename to src/include/defaults.mk index 36e922f5ba7..7290187ceba 100644 --- a/Make.defaults +++ b/src/include/defaults.mk @@ -34,7 +34,7 @@ CPPFLAGS += -DLIBEFIVAR_VERSION=$(VERSION) clang_cflags = -D_GNU_SOURCE -std=gnu11 -Wno-address-of-packed-member \ -funsigned-char -Wall -Wno-nonnull-compare \ -Werror -Wno-error=cpp -gcc_cflags = -specs=$(TOPDIR)/gcc.specs +gcc_cflags = -specs=$(TOPDIR)/src/include/gcc.specs cflags = $(CFLAGS) -I${TOPDIR}/src/include/ \ $(if $(findstring clang,$(CC)),$(clang_cflags),) \ $(if $(findstring ccc-analyzer,$(CC)),$(clang_cflags),) \ diff --git a/Make.deprecated b/src/include/deprecated.mk similarity index 100% rename from Make.deprecated rename to src/include/deprecated.mk diff --git a/src/Make.deps b/src/include/deps.mk similarity index 65% rename from src/Make.deps rename to src/include/deps.mk index c3df9e46559..a797d1bdbf5 100644 --- a/src/Make.deps +++ b/src/include/deps.mk @@ -1,11 +1,10 @@ SRCDIR = $(realpath .) -TOPDIR = $(realpath ..) all : deps -include $(TOPDIR)/Make.version -include $(TOPDIR)/Make.rules -include $(TOPDIR)/Make.defaults +include $(TOPDIR)/src/include/version.mk +include $(TOPDIR)/src/include/rules.mk +include $(TOPDIR)/src/include/defaults.mk .%.d : %.c $(CC) $(cflags) $(CPPFLAGS) -MM -MG -MF $@ $^ diff --git a/gcc.specs b/src/include/gcc.specs similarity index 100% rename from gcc.specs rename to src/include/gcc.specs diff --git a/Make.rules b/src/include/rules.mk similarity index 98% rename from Make.rules rename to src/include/rules.mk index 042585b533c..1783dda573b 100644 --- a/Make.rules +++ b/src/include/rules.mk @@ -2,7 +2,7 @@ default : all .PHONY: default all clean install test -include $(TOPDIR)/Make.version +include $(TOPDIR)/src/include/version.mk %.a : $(AR) -cvqs $@ $^ diff --git a/Make.scan-build b/src/include/scan-build.mk similarity index 100% rename from Make.scan-build rename to src/include/scan-build.mk diff --git a/Make.version b/src/include/version.mk similarity index 100% rename from Make.version rename to src/include/version.mk diff --git a/src/test/Makefile b/src/test/Makefile index 4c2a18f8426..df16c7a5f3b 100644 --- a/src/test/Makefile +++ b/src/test/Makefile @@ -1,8 +1,7 @@ SRCDIR = $(realpath .) -TOPDIR = $(realpath $(SRCDIR)/../..) -include $(TOPDIR)/Make.defaults -include $(TOPDIR)/Make.version +include $(TOPDIR)/src/include/defaults.mk +include $(TOPDIR)/src/include/version.mk ccldflags += -L$(TOPDIR)/src/ -Wl,-rpath=$(TOPDIR)/src/ LIBS=efivar @@ -22,4 +21,4 @@ tester :: tester.o .PHONY: all clean install test -include $(TOPDIR)/Make.rules +include $(TOPDIR)/src/include/rules.mk diff --git a/tests/Makefile b/tests/Makefile index 5e0c604e355..6f233d53fd1 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,8 +6,7 @@ all: clean test0 test1 test2 test3 test4 GRUB_PREFIX ?= grub2 -TOPDIR ?= .. -EFIVAR ?= ../src/efivar +EFIVAR ?= $(TOPDIR)/src/efivar clean: @rm -f *.result.env *.result.var -- 2.24.1