Skip to content

Commit

Permalink
Use $OBJCOPY and $STRIP instead of hardcoding
Browse files Browse the repository at this point in the history
  • Loading branch information
lanodan committed Jan 13, 2024
1 parent 967eea0 commit d267614
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
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
6 changes: 3 additions & 3 deletions tools/minicargo/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,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
$(OBJCOPY) --add-gnu-debuglink=$(BIN).debug $(BIN)
$(STRIP) $(BIN)
endif

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

0 comments on commit d267614

Please sign in to comment.