initial commit
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
diff --git a/Makefile b/Makefile
|
||||
index 5f1dc88..1ef6fcd 100644
|
||||
--- a/Makefile
|
||||
+++ b/Makefile
|
||||
@@ -35,12 +35,12 @@ brick : all
|
||||
done
|
||||
|
||||
a :
|
||||
- @if [ $${EUID} != 0 ]; then \
|
||||
+ @if [ "$$(id -u)" != 0 ]; then \
|
||||
echo no 1>&2 ; \
|
||||
exit 1 ; \
|
||||
fi
|
||||
|
||||
-GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))")
|
||||
+GITTAG = $(shell printf '%s\n' $$(( $(VERSION) + 1 )))
|
||||
|
||||
efivar.spec : | Makefile src/include/version.mk
|
||||
|
||||
diff --git a/src/include/defaults.mk b/src/include/defaults.mk
|
||||
index 4da0cde..40f4d51 100644
|
||||
--- a/src/include/defaults.mk
|
||||
+++ b/src/include/defaults.mk
|
||||
@@ -11,13 +11,15 @@ PKGS ?=
|
||||
|
||||
CROSS_COMPILE ?=
|
||||
COMPILER ?= gcc
|
||||
-ifeq ($(origin CC),command line)
|
||||
-override COMPILER := $(CC)
|
||||
-override CC := $(CROSS_COMPILE)$(COMPILER)
|
||||
-endif
|
||||
+
|
||||
+tool-if-exists = $(strip $(shell command -v $(1) >/dev/null 2>&1 && printf '%s' '$(1)'))
|
||||
+cc-command = $(firstword $(filter-out ccache sccache distcc,$(foreach word,$(1),$(notdir $(word)))))
|
||||
+cc-name = $(patsubst $(CROSS_COMPILE)%,%,$(call cc-command,$(1)))
|
||||
+
|
||||
$(call set-if-undefined,CC,$(CROSS_COMPILE)$(COMPILER))
|
||||
+override COMPILER := $(or $(call cc-name,$(CC)),$(COMPILER))
|
||||
$(call set-if-undefined,CCLD,$(CC))
|
||||
-$(call set-if-undefined,HOSTCC,$(COMPILER))
|
||||
+$(call set-if-undefined,HOSTCC,$(call cc-name,$(CC)))
|
||||
$(call set-if-undefined,HOSTCCLD,$(HOSTCC))
|
||||
|
||||
# temporary, see https://sourceware.org/bugzilla/show_bug.cgi?id=28264
|
||||
@@ -107,11 +109,11 @@ override HOST_LDFLAGS = $(HOST_CFLAGS) -L. \
|
||||
$(call pkg-config-ccldflags)
|
||||
override HOST_CCLDFLAGS = $(HOST_LDFLAGS)
|
||||
|
||||
-PKG_CONFIG ?= $(shell if [ -e "$$(env $(CROSS_COMPILE)pkg-config 2>&1)" ]; then echo $(CROSS_COMPILE)pkg-config ; else echo pkg-config ; fi)
|
||||
+PKG_CONFIG ?= $(or $(call tool-if-exists,$(CROSS_COMPILE)pkg-config),pkg-config)
|
||||
INSTALL ?= install
|
||||
-AR := $(CROSS_COMPILE)$(COMPILER)-ar
|
||||
-NM := $(CROSS_COMPILE)$(COMPILER)-nm
|
||||
-RANLIB := $(CROSS_COMPILE)$(COMPILER)-ranlib
|
||||
+$(call set-if-undefined,AR,$(or $(call tool-if-exists,$(CROSS_COMPILE)$(call cc-name,$(CC))-ar),$(if $(findstring clang,$(call cc-name,$(CC))),$(call tool-if-exists,$(CROSS_COMPILE)llvm-ar),$(call tool-if-exists,$(CROSS_COMPILE)gcc-ar)),$(call tool-if-exists,$(CROSS_COMPILE)ar),ar))
|
||||
+$(call set-if-undefined,NM,$(or $(call tool-if-exists,$(CROSS_COMPILE)$(call cc-name,$(CC))-nm),$(if $(findstring clang,$(call cc-name,$(CC))),$(call tool-if-exists,$(CROSS_COMPILE)llvm-nm),$(call tool-if-exists,$(CROSS_COMPILE)gcc-nm)),$(call tool-if-exists,$(CROSS_COMPILE)nm),nm))
|
||||
+$(call set-if-undefined,RANLIB,$(or $(call tool-if-exists,$(CROSS_COMPILE)$(call cc-name,$(CC))-ranlib),$(if $(findstring clang,$(call cc-name,$(CC))),$(call tool-if-exists,$(CROSS_COMPILE)llvm-ranlib),$(call tool-if-exists,$(CROSS_COMPILE)gcc-ranlib)),$(call tool-if-exists,$(CROSS_COMPILE)ranlib),ranlib))
|
||||
ABIDW := abidw
|
||||
ABIDIFF := abidiff
|
||||
MANDOC := mandoc
|
||||
diff --git a/src/include/coverity.mk b/src/include/coverity.mk
|
||||
index 2e7024b..f852097 100644
|
||||
--- a/src/include/coverity.mk
|
||||
+++ b/src/include/coverity.mk
|
||||
@@ -4,11 +4,11 @@ COV_URL=$(call get-config,coverity.url)
|
||||
COV_FILE=$(NAME)-coverity-$(VERSION)-$(COMMIT_ID).tar.bz2
|
||||
|
||||
cov-int : clean
|
||||
- cov-build --dir cov-int make all
|
||||
+ cov-build --dir cov-int $(MAKE) all
|
||||
|
||||
cov-clean :
|
||||
@rm -vf $(NAME)-coverity-*.tar.*
|
||||
- @if [[ -d cov-int ]]; then rm -rf cov-int && echo "removed 'cov-int'"; fi
|
||||
+ @if [ -d cov-int ]; then rm -rf cov-int && echo "removed 'cov-int'"; fi
|
||||
|
||||
cov-file : | $(COV_FILE)
|
||||
|
||||
@@ -16,9 +16,9 @@ $(COV_FILE) : cov-int
|
||||
tar caf $@ cov-int
|
||||
|
||||
cov-upload :
|
||||
- @if [[ -n "$(COV_URL)" ]] && \
|
||||
- [[ -n "$(COV_TOKEN)" ]] && \
|
||||
- [[ -n "$(COV_EMAIL)" ]] ; \
|
||||
+ @if [ -n "$(COV_URL)" ] && \
|
||||
+ [ -n "$(COV_TOKEN)" ] && \
|
||||
+ [ -n "$(COV_EMAIL)" ] ; \
|
||||
then \
|
||||
echo curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \
|
||||
curl --form token=$(COV_TOKEN) --form email="$(COV_EMAIL)" --form file=@"$(COV_FILE)" --form version=$(VERSION).1 --form description="$(COMMIT_ID)" "$(COV_URL)" ; \
|
||||
@@ -31,7 +31,7 @@ coverity : cov-file cov-upload
|
||||
|
||||
clean : | cov-clean
|
||||
|
||||
-COV_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions cov-build 2>/dev/null) ; [ -n "$$x" ] && echo 1)
|
||||
+COV_BUILD ?= $(shell command -v cov-build >/dev/null 2>&1 && printf '%s' 1)
|
||||
ifeq ($(COV_BUILD),)
|
||||
COV_BUILD_ERROR = $(error cov-build not found)
|
||||
endif
|
||||
diff --git a/src/include/scan-build.mk b/src/include/scan-build.mk
|
||||
index 19da90c..125c85c 100644
|
||||
--- a/src/include/scan-build.mk
|
||||
+++ b/src/include/scan-build.mk
|
||||
@@ -1,4 +1,4 @@
|
||||
-SCAN_BUILD ?= $(shell x=$$(which --skip-alias --skip-functions scan-build 2>/dev/null) ; [ -n "$$x" ] && echo 1)
|
||||
+SCAN_BUILD ?= $(shell command -v scan-build >/dev/null 2>&1 && printf '%s' 1)
|
||||
ifeq ($(SCAN_BUILD),)
|
||||
SCAN_BUILD_ERROR = $(error scan-build not found)
|
||||
endif
|
||||
@@ -6,12 +6,12 @@ endif
|
||||
scan-test : ; $(SCAN_BUILD_ERROR)
|
||||
|
||||
scan-clean : clean
|
||||
- @if [[ -d scan-results ]]; then rm -rf scan-results && echo "removed 'scan-results'"; fi
|
||||
+ @if [ -d scan-results ]; then rm -rf scan-results && echo "removed 'scan-results'"; fi
|
||||
|
||||
scan-build : | scan-test
|
||||
scan-build : clean
|
||||
$(MAKE) -C src makeguids
|
||||
- scan-build -o scan-results make $(DASHJ) CC=clang all
|
||||
+ scan-build -o scan-results $(MAKE) $(DASHJ) CC=clang all
|
||||
|
||||
scan-build-all: | scan-build
|
||||
scan : | scan-build
|
||||
Reference in New Issue
Block a user