shithub: libmujs

Download patch

ref: 58b44200948f0691f34b45b2718ec572f4261277
parent: 1062e70c86132e8784a16370892174ed32cc9cd1
author: Tor Andersson <tor.andersson@gmail.com>
date: Mon Apr 17 19:25:45 EDT 2017

Add function-level linking.

--- a/Makefile
+++ b/Makefile
@@ -16,16 +16,20 @@
 ifeq "$(build)" "debug"
 CFLAGS += -g
 else
-CFLAGS += -O2
+CFLAGS += -Os
+ifeq "$(shell uname)" "Linux"
+CFLAGS += -ffunction-sections -fdata-sections
+LDFLAGS += -Wl,--gc-sections -Wl,-s
 endif
+endif
 
 default: build build/mujs build/mujsone
 
 debug:
-	$(MAKE) build=debug
+	$(MAKE) build=debug clean default
 
 release:
-	$(MAKE) build=release
+	$(MAKE) build=release clean default
 
 astnames.h: jsparse.h
 	grep -E '(AST|EXP|STM)_' jsparse.h | sed 's/^[^A-Z]*\(AST_\)*/"/;s/,.*/",/' | tr A-Z a-z > $@
--- a/docs/about.html
+++ b/docs/about.html
@@ -59,7 +59,7 @@
 
 <p>
 Adding MuJS to an application does not bloat it.
-The source contains around 10'000 lines of C.
+The source contains around 12'000 lines of C.
 Under Linux, the compiled library takes 180kB if optimized for size,
 and 260kB if optimized for speed.