fix Makefile

This commit is contained in:
Vinzenz Schroeter 2025-06-18 17:25:11 +02:00
parent 9ddab5e19a
commit 7d52ccf638

View file

@ -47,6 +47,8 @@ CARGOFLAGS += --manifest-path=$(REPO_ROOT)/Cargo.toml \
--target=$(RUST_TARGET) \
--target-dir=cargo
STATIC_LINK_LIBS += -lservicepoint_binding_c
_servicepoint_cflags := -I $(REPO_ROOT)/include -L $(CARGO_OBJDIR)
CFLAGS += -Wall -Wextra -pedantic -fwhole-program -fPIE -pie
_no_debug_cflags := -ffunction-sections -fdata-sections -Wl,--gc-sections
size_optimized_CFLAGS += -Oz \
@ -69,7 +71,7 @@ debug_CFLAGS += -Og
static_CFLAGS += -static $(STATIC_LINK_LIBS)
dynamic_CFLAGS += -Wl,-Bstatic $(STATIC_LINK_LIBS) -Wl,-Bdynamic
_servicepoint_cflags := $(pkg-config --libs servicepoint --cflags)
_servicepoint_cflags := $(shell pkg-config --libs servicepoint --cflags || echo -I $(REPO_ROOT)/include -L $(CARGO_OBJDIR))
CFLAGS += $($(_libc)_CFLAGS) $($(_profile)_CFLAGS) $($(_link_type)_CFLAGS) $(_servicepoint_cflags)
ifeq ($(LTO), 1)
CFLAGS += -flto
@ -103,7 +105,7 @@ _unstripped_bins := $(addsuffix _unstripped, $(_bins))
.PHONY: all build-rust
all: $(_bins)
all: build-rust $(_bins)
$(_unstripped_bins): %_unstripped : src/%.c src/helpers.h build-rust
$(CC) $< $(CFLAGS) -o $@