Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use $OBJCOPY and $STRIP instead of hardcoding #327

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ V ?= !
# GPROF : If set, enables the generation of a gprof annotated executable
GPROF ?=

OBJCOPY ?= objcopy
STRIP ?= strip

ifneq ($(VERBOSE),)
V :=
endif
Expand Down Expand Up @@ -169,9 +172,9 @@ else ifeq ($(shell uname -s || echo not),Darwin)
$V$(CXX) -o $@ $(LINKFLAGS) $(OBJDIR)main.o -Wl,-all_load bin/mrustc.a bin/common_lib.a $(LIBS)
else
$V$(CXX) -o $@ $(LINKFLAGS) $(OBJDIR)main.o -Wl,--whole-archive bin/mrustc.a -Wl,--no-whole-archive bin/common_lib.a $(LIBS)
objcopy --only-keep-debug $(BIN) $(BIN).debug
objcopy --add-gnu-debuglink=$(BIN).debug $(BIN)
strip $(BIN)
$(OBJCOPY) --only-keep-debug $(BIN) $(BIN).debug
$(OBJCOPY) --add-gnu-debuglink=$(BIN).debug $(BIN)
$(STRIP) $(BIN)
endif

$(OBJDIR)%.o: src/%.cpp
Expand Down
9 changes: 6 additions & 3 deletions tools/minicargo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ ifeq ($(OS),Windows_NT)
endif
EXESUF ?=

OBJCOPY ?= objcopy
STRIP ?= strip

V ?= @

OBJDIR := .obj/
Expand Down Expand Up @@ -41,9 +44,9 @@ $(BIN): $(OBJS) ../../bin/common_lib.a
ifeq ($(OS),Windows_NT)
else ifeq ($(shell uname -s || echo not),Darwin)
else
objcopy --only-keep-debug $(BIN) $(BIN).debug
objcopy --add-gnu-debuglink=$(BIN).debug $(BIN)
strip $(BIN)
$(OBJCOPY) --only-keep-debug $(BIN) $(BIN).debug
thepowersgang marked this conversation as resolved.
Show resolved Hide resolved
$(OBJCOPY) --add-gnu-debuglink=$(BIN).debug $(BIN)
$(STRIP) $(BIN)
endif

$(OBJDIR)%.o: %.cpp
Expand Down
Loading