Skip to content

Commit

Permalink
initial gcc support [closes #225]
Browse files Browse the repository at this point in the history
  • Loading branch information
stsp committed Jan 2, 2025
1 parent 02c0f51 commit ddea769
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions fdpp/clang.mak
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,17 @@ else
$(error binutils-x86-64-linux-gnu not installed)
endif
endif
# don't use ?= here as that doesn't override make's builtin CC var
CC = clang
CXX = clang++
CLANG_VER := $(shell $(CXX) -v 2>&1 | head -n 1 | \
CLANG_VER := $(shell $(CXX) --version 2>&1 | head -n 1 | grep clang | \
sed -E 's/.+ version ([^.]+)\.[^.]+\.[^ ]+.*/\1/')
ifeq ($(CLANG_VER),)
# its gcc, set to 16 as it had buggy packed diagnostic, similar to gcc
CLANG_VER := 16
GCC_VER := $(shell $(CXX) --version 2>&1 | head -n 1 | grep GCC | \
sed -E 's/.+ \(GCC\) ([^.]+)\.[^.]+\.[^ ]+.*/\1/')
ifeq ($(GCC_VER),)
$(error unknown compiler)
endif
endif
FLEX = $(shell which flex 2>/dev/null)
ifneq ($(FLEX),)
LEX = $(FLEX)
Expand All @@ -40,7 +46,9 @@ export PKG_CONFIG
TARGETOPT = -std=c++20 -c -fno-threadsafe-statics -fpic \
-DCLANG_VER=$(CLANG_VER)
# _XTRA should go at the end of cmd line
ifeq ($(GCC_VER),)
TARGETOPT_XTRA = -Wno-format-invalid-specifier -Wno-c99-designator
endif

DEBUG_MODE ?= 1
EXTRA_DEBUG ?= 0
Expand All @@ -50,11 +58,15 @@ USE_UBSAN ?= 0

IFLAGS = -iquote $(srcdir)/../hdr
CPPFLAGS += $(IFLAGS) -DFDPP
WFLAGS = -Wall -Werror=packed-non-pod -Wno-unknown-warning-option \
-Wno-address-of-packed-member
ifeq ($(GCC_VER),)
WFLAGS := -Wall -Werror=packed-non-pod -Wno-unknown-warning-option
ifneq ($(CLANG_VER),16)
WFLAGS += -Wpacked
endif
else
WFLAGS := -Wno-attributes
endif
WFLAGS += -Wno-address-of-packed-member
WCFLAGS = $(WFLAGS)
ifeq ($(DEBUG_MODE),1)
DBGFLAGS += -ggdb3
Expand Down

0 comments on commit ddea769

Please sign in to comment.