Skip to content

Commit

Permalink
repair buildroot support
Browse files Browse the repository at this point in the history
  • Loading branch information
stsp committed Nov 23, 2023
1 parent 44c4947 commit bb283ec
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
17 changes: 10 additions & 7 deletions fdpp/clang.mak
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,25 @@
# CLANG.MAK - kernel copiler options for clang
#

LD ?= ld
CROSS_LD ?= x86_64-linux-gnu-ld
CCACHE ?= $(shell which ccache 2>/dev/null)
CC = $(CCACHE) clang
CC ?= $(CCACHE) clang
CXX = $(CCACHE) clang++
CLANG_VER := $(shell $(CC) -v 2>&1 | head -n 1 | \
CLANG_VER := $(shell $(CXX) -v 2>&1 | head -n 1 | \
sed -E 's/.+ version ([^.]+)\.[^.]+\.[^ ]+.*/\1/')
FLEX = $(shell which flex 2>/dev/null)
ifneq ($(FLEX),)
LEX = $(FLEX)
endif

CC_FOR_BUILD = $(CCACHE) clang
CC_FOR_BUILD ?= $(CC)
CPP = $(CC_FOR_BUILD) -E
CC_LD = $(CXX)
CL = $(CC)
ifeq ($(CXX_LD),)
CXX_LD = $(CXX)
endif
ifeq ($(CC_LD),)
CC_LD = $(CC)
endif
NASM ?= nasm-segelf
PKG_CONFIG ?= pkg-config

Expand Down Expand Up @@ -60,7 +63,7 @@ endif

CXXFLAGS = $(TARGETOPT) $(CPPFLAGS) $(WFLAGS) $(DBGFLAGS) $(TARGETOPT_XTRA)
CFLAGS = -Wall $(DBGFLAGS)
CLCFLAGS = -c -fpic $(WCFLAGS) $(DBGFLAGS) -xc++
CLCFLAGS = -c -fpic -Wall $(DBGFLAGS) -xc++
LDFLAGS = -shared -Wl,--build-id=sha1

ifeq ($(XFAT),32)
Expand Down
2 changes: 1 addition & 1 deletion fdpp/loader/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ALL = $(T)/$(FDPPLIB)
all: $(ALL)

$(T)/$(FDPPLIB): $(OBJECTS)
$(CL) -o $@ $^ $(LDFLAGS) $(LIBS)
$(CC_LD) -o $@ $^ $(LDFLAGS) $(LIBS)

$(OBJECTS): %.o: $(srcdir)/%.c $(addprefix $(srcdir)/,$(HEADERS)) $(srcdir)/makefile
$(CC) $(CFLAGS) -c -o $@ $<
Expand Down
10 changes: 5 additions & 5 deletions fdpp/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -127,24 +127,24 @@ FDPP_CCOBJS = $(FDPP_CCFILES:.cc=.o)
FDPP_CPPOBJS = $(CPPFILES:.cpp=.o)

$(OBJECTS): %.o: %.cc $(HEADERS) $(GEN_HEADERS_FD) $(EXT_H)
$(CC) $(CXXFLAGS) -o $@ $<
$(CXX) $(CXXFLAGS) -o $@ $<

$(FDPP_COBJS): %.o: $(srcdir)/%.c $(PPHDRS) $(srcdir)/makefile
$(CC) $(CLCFLAGS) -I . -o $@ $<
$(CXX) $(CLCFLAGS) -I . -o $@ $<

thunks.o: $(EXT_H) $(GIT_REV)
thunks_a.o: $(SRC)/glob_asm.h $(srcdir)/glob_tmpl.h plt_asmc.h plt_asmp.h
$(FDPP_CCOBJS): %.o: $(srcdir)/%.cc $(GEN_HEADERS) $(PPHDRS) $(srcdir)/makefile
$(CC) $(CXXFLAGS) -o $@ $<
$(CXX) $(CXXFLAGS) -o $@ $<

$(FDPP_CPPOBJS): %.o: $(srcdir)/%.cpp $(PPHDRS) $(srcdir)/makefile
$(CC) $(CXXFLAGS) -o $@ $<
$(CXX) $(CXXFLAGS) -o $@ $<

$(GEN_CC): %.cc: $(SRC)/%.c makefile
$(srcdir)/parsers/mkfar.sh $< >$@

$(FDPPLIB): $(OBJECTS) $(FDPP_COBJS) $(FDPP_CCOBJS) $(FDPP_CPPOBJS)
$(CC_LD) -o $@ $^ $(LDFLAGS) $(LIBS)
$(CXX_LD) -o $@ $^ $(LDFLAGS) $(LIBS)
@echo "Have `nm -u $@ | grep "U " | wc -l` undefined symbols"

$(FDPPDEVL): $(FDPPLIB)
Expand Down

0 comments on commit bb283ec

Please sign in to comment.