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

Revise Makefile for macOS and add DEBUGINFO option #18044

Closed
wants to merge 2 commits into from
Closed

Revise Makefile for macOS and add DEBUGINFO option #18044

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Aug 16, 2016

Splited from #17898 , this pull request fixes wrong LTO linker parameters on macOS, and adds an option named DEBUGINFO for users who wish to retain debug information on an optimized release build.

@ghost ghost closed this Aug 17, 2016
@ghost
Copy link
Author

ghost commented Aug 17, 2016

diff --git a/Makefile b/Makefile
index 4a82fdf..b085d3b 100644
--- a/Makefile
+++ b/Makefile
@@ -190,7 +190,9 @@ ifdef RELEASE
   CXXFLAGS += $(OPTLEVEL)

   ifdef LTO
-    LDFLAGS += -fuse-ld=gold
+    ifneq ($(NATIVE), osx)
+      LDFLAGS += -fuse-ld=gold
+    endif
     ifdef CLANG
       LTOFLAGS += -flto
     else
@@ -200,9 +202,13 @@ ifdef RELEASE
   CXXFLAGS += $(LTOFLAGS)

   # OTHERS += -mmmx -m3dnow -msse -msse2 -msse3 -mfpmath=sse -mtune=native
-  # Strip symbols, generates smaller executable.
+  # if DEBUGINFO not defined, then strip symbols, generates smaller executable.
   OTHERS += $(RELEASE_FLAGS)
-  DEBUG =
+  ifdef DEBUGINFO
+    LDFLAGS += -g
+  else
+    DEBUG =
+  endif
   DEFINES += -DRELEASE
   # Check for astyle or JSON regressions on release builds.
   CHECKS = astyle-check json-lint
@@ -615,7 +621,9 @@ all: version $(CHECKS) $(TARGET) $(L10N) tests
 $(TARGET): $(ODIR) $(OBJS)
    +$(LD) $(W32FLAGS) -o $(TARGET) $(OBJS) $(LDFLAGS)
 ifdef RELEASE
+  ifndef DEBUGINFO
    $(STRIP) $(TARGET)
+  endif
 endif

 $(BUILD_PREFIX)$(TARGET_NAME).a: $(ODIR) $(OBJS)

@Zireael07
Copy link
Contributor

Why close?

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant