diff -uNr vdo-8.2.2.2-patchedbackup/utils/uds/Makefile vdo-8.2.2.2-patched/utils/uds/Makefile --- vdo-8.2.2.2-patchedbackup/utils/uds/Makefile 2024-09-27 10:05:29.529846385 +0800 +++ vdo-8.2.2.2-patched/utils/uds/Makefile 2024-09-27 10:34:25.699840596 +0800 @@ -22,42 +22,46 @@ DEPDIR = .deps -ifeq ($(origin CC), default) - CC=gcc -endif - ifeq ($(filter riscv64%,$(MAKE_HOST)),) Wcast-align = -Wcast-align endif -WARNS = -Wall \ - $(Wcast-align) \ - -Werror \ - -Wextra \ - -Winit-self \ - -Wlogical-op \ - -Wmissing-include-dirs \ - -Wpointer-arith \ - -Wredundant-decls \ - -Wunused \ - -Wwrite-strings - -C_WARNS = -Wbad-function-cast \ - -Wcast-qual \ - -Wfloat-equal \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-format-attribute \ - -Wmissing-prototypes \ - -Wnested-externs \ - -Wold-style-definition \ - -Wswitch-default + +# Define WARNS and C_WARNS only if using gcc +CLANG_VERSION := $(shell $(CC) --version | grep -i clang) +ifeq ($(findstring clang, $(CLANG_VERSION)),clang) +WARNS = +C_WARNS = +else +WARNS = -Wall \ + $(Wcast-align) \ + -Werror \ + -Wextra \ + -Winit-self \ + -Wlogical-op \ + -Wmissing-include-dirs \ + -Wpointer-arith \ + -Wredundant-decls \ + -Wunused \ + -Wwrite-strings + +C_WARNS = -Wbad-function-cast \ + -Wcast-qual \ + -Wfloat-equal \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-format-attribute \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wold-style-definition \ + -Wswitch-default +endif OPT_FLAGS = -O3 -fno-omit-frame-pointer DEBUG_FLAGS = RPM_OPT_FLAGS ?= -fpic -GLOBAL_FLAGS = $(RPM_OPT_FLAGS) -D_GNU_SOURCE -g $(OPT_FLAGS) \ - $(WARNS) $(shell getconf LFS_CFLAGS) $(DEBUG_FLAGS) \ - -DCURRENT_VERSION='"$(BUILD_VERSION)"' \ +GLOBAL_FLAGS = $(RPM_OPT_FLAGS) -D_GNU_SOURCE -g $(OPT_FLAGS) \ + $(WARNS) $(shell getconf LFS_CFLAGS) $(DEBUG_FLAGS) \ + -DCURRENT_VERSION='"$(BUILD_VERSION)"' CFLAGS = $(GLOBAL_FLAGS) -I. -std=gnu99 -pedantic $(C_WARNS) $(MY_CFLAGS) LDFLAGS = $(RPM_LD_FLAGS) $(MY_LDFLAGS) @@ -69,48 +73,48 @@ vpath %.c . vpath %.c ./murmur -UDS_OBJECTS = murmurhash3.o \ - buffer.o \ - buffered-reader.o \ - buffered-writer.o \ - chapter-index.o \ - config.o \ - delta-index.o \ - errors.o \ - event-count.o \ - fileIORegion.o \ - fileUtils.o \ - funnel-queue.o \ - geometry.o \ - hash-utils.o \ - index.o \ - index-layout.o \ - index-page-map.o \ - index-session.o \ - ioFactory.o \ - logger.o \ - memoryAlloc.o \ - minisyslog.o \ - open-chapter.o \ - page-cache.o \ - permassert.o \ - radix-sort.o \ - random.o \ - record-page.o \ - requestQueue.o \ - sparse-cache.o \ - string-utils.o \ - syscalls.o \ - threadCondVar.o \ - threadMutex.o \ - threadSemaphore.o \ - time-utils.o \ - uds-threads.o \ - volume.o \ - volume-index005.o \ - volume-index006.o \ - volume-index-ops.o \ - volume-store.o +UDS_OBJECTS = murmurhash3.o \ + buffer.o \ + buffered-reader.o \ + buffered-writer.o \ + chapter-index.o \ + config.o \ + delta-index.o \ + errors.o \ + event-count.o \ + fileIORegion.o \ + fileUtils.o \ + funnel-queue.o \ + geometry.o \ + hash-utils.o \ + index.o \ + index-layout.o \ + index-page-map.o \ + index-session.o \ + ioFactory.o \ + logger.o \ + memoryAlloc.o \ + minisyslog.o \ + open-chapter.o \ + page-cache.o \ + permassert.o \ + radix-sort.o \ + random.o \ + record-page.o \ + requestQueue.o \ + sparse-cache.o \ + string-utils.o \ + syscalls.o \ + threadCondVar.o \ + threadMutex.o \ + threadSemaphore.o \ + time-utils.o \ + uds-threads.o \ + volume.o \ + volume-index005.o \ + volume-index006.o \ + volume-index-ops.o \ + volume-store.o .PHONY: all all: libuds.a @@ -129,7 +133,6 @@ %.s: %.c $(CC) $(CFLAGS) -S $^ - ######################################################################## # Dependency processing diff -uNr vdo-8.2.2.2-patchedbackup/utils/vdo/Makefile vdo-8.2.2.2-patched/utils/vdo/Makefile --- vdo-8.2.2.2-patchedbackup/utils/vdo/Makefile 2024-09-27 10:05:29.529846385 +0800 +++ vdo-8.2.2.2-patched/utils/vdo/Makefile 2024-09-27 10:34:19.959840728 +0800 @@ -25,30 +25,34 @@ ifeq ($(filter riscv64%,$(MAKE_HOST)),) Wcast-align = -Wcast-align endif -WARNS = \ - -Wall \ - $(Wcast-align) \ - -Werror \ - -Wextra \ - -Winit-self \ - -Wlogical-op \ - -Wmissing-include-dirs \ - -Wpointer-arith \ - -Wredundant-decls \ - -Wunused \ - -Wwrite-strings \ +CLANG_VERSION := $(shell $(CC) --version | grep -i clang) +ifeq ($(findstring clang, $(CLANG_VERSION)),clang) +WARNS = +C_WARNS = +else +WARNS = -Wall \ + $(Wcast-align) \ + -Werror \ + -Wextra \ + -Winit-self \ + -Wlogical-op \ + -Wmissing-include-dirs \ + -Wpointer-arith \ + -Wredundant-decls \ + -Wunused \ + -Wwrite-strings -C_WARNS = \ - -Wbad-function-cast \ - -Wcast-qual \ - -Wfloat-equal \ - -Wformat=2 \ - -Wmissing-declarations \ - -Wmissing-format-attribute \ - -Wmissing-prototypes \ - -Wnested-externs \ - -Wold-style-definition \ - -Wswitch-default \ +C_WARNS = -Wbad-function-cast \ + -Wcast-qual \ + -Wfloat-equal \ + -Wformat=2 \ + -Wmissing-declarations \ + -Wmissing-format-attribute \ + -Wmissing-prototypes \ + -Wnested-externs \ + -Wold-style-definition \ + -Wswitch-default +endif ifeq ($(AR), ar) ifeq ($(origin AR), default)