Makefiles: separate debug information to a separate `.debug` files stx-8.0.0
authorJan Vrany <jan.vrany@fit.cvut.cz>
Wed, 29 Nov 2017 16:46:46 +0000
branchstx-8.0.0
changeset 207 3262e8cf1146
parent 206 3808e177d59d
child 208 616e1ecf4d89
Makefiles: separate debug information to a separate `.debug` files ...in order to make binaries (`*.so`, `*.dll`) smaller. This also makes the "toy" Smalltalk/X jv-branch archive smaller.
makelib/config.make
makelib/definitions-w.make
makelib/rules-w.make
makelib/rules.make
--- a/makelib/config.make	Sun Nov 26 09:18:54 2017 +0000
+++ b/makelib/config.make	Wed Nov 29 16:46:46 2017 +0000
@@ -115,7 +115,9 @@
 
 # misc
 STRIP=strip
+OBJCOPY=objcopy
 DIRNAME=dirname
+CHMOD=chmod
 #
 # all BSD-based expr-implementations are missing the substring function
 #
--- a/makelib/definitions-w.make	Sun Nov 26 09:18:54 2017 +0000
+++ b/makelib/definitions-w.make	Wed Nov 29 16:46:46 2017 +0000
@@ -330,6 +330,8 @@
 RFLAGS=
 RES=$(O)
 APP_LINKER=$(CC)
+STRIP=$(MINGWBINDIR)\strip.exe
+OBJCOPY=$(MINGWBINDIR)\objcopy.exe
 
 !    if defined(USEMINGW32)
 USE_ARG=-DUSEMINGW32=1
--- a/makelib/rules-w.make	Sun Nov 26 09:18:54 2017 +0000
+++ b/makelib/rules-w.make	Wed Nov 29 16:46:46 2017 +0000
@@ -357,7 +357,9 @@
 		$(LIBINIT_FILE) $(IOBJS) $(OBJS)
 $ \
 		$(ALLLIB) $(X11_LIBS) -o $(OUTDIR_SLASH)$(LIBNAME).dll
-
+	$(OBJCOPY) --only-keep-debug $(OUTDIR)$(LIBNAME).dll $(OUTDIR)$(LIBNAME).dll.debug
+	$(STRIP) --strip-debug --strip-unneeded $(OUTDIR)$(LIBNAME).dll
+	$(OBJCOPY) --add-gnu-debuglink="$(OUTDIR)$(LIBNAME).dll.debug" $(OUTDIR)$(LIBNAME).dll
 	$(MAKE) -f bc.mak registerClassLib
 
 cLibRule:
--- a/makelib/rules.make	Sun Nov 26 09:18:54 2017 +0000
+++ b/makelib/rules.make	Wed Nov 29 16:46:46 2017 +0000
@@ -253,7 +253,7 @@
 
 #
 # unconditionally makes a new makefile
-# obsolete.
+# o$lete.
 #
 makeMakefile:
 	@echo "making $(MAKEFILE) for $(CONF) $(CONF_PACKS) ..."
@@ -1090,6 +1090,10 @@
 $(LIBNAME).$(SO): $(LIBNAME)$(OBJNAME)
 	@echo "linking class library ..."
 	$(LD) -shared $(LDFLAGS) -o $@ $< $(LOCAL_SHARED_LIBS) $(EXTRA_SHARED_LIBS)
+	$(OBJCOPY) --only-keep-debug $@ $@.debug
+	$(CHMOD) ugo-x $@.debug
+	$(STRIP) --strip-debug --strip-unneeded $@
+	$(OBJCOPY) --add-gnu-debuglink="$@.debug" $@
 
 newobj_staticLink::
 	@echo "linking static classLib object ..."