commit: fc0d2fc7d05c1f61e822a250de497c099b2b8cd9
parent 40dcb00be09df8d0ead610f80bd975d1e3f1a8af
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Sat, 3 Apr 2021 18:55:26 +0200
Makefile: Optimise for size
Diffstat:
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/C/Makefile b/C/Makefile
@@ -1,5 +1,7 @@
WAYLAND_PROTOCOLS=`pkg-config --variable=pkgdatadir wayland-protocols`
WAYLAND_SCANNER=`pkg-config --variable=wayland_scanner wayland-scanner`
+CFLAGS=-Os -march=native -mtune=native -ffunction-sections -fdata-sections
+LDFLAGS=-Wl,--gc-sections
.SUFFIXES: .au
@@ -15,7 +17,8 @@ xdg-shell-protocol.c: xdg-shell-client-protocol.h
$(WAYLAND_SCANNER) private-code $(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
wayland: wayland.c xdg-shell-protocol.c
- $(CC) $(CFLAGS) -o $@ $< xdg-shell-protocol.c -lwayland-client -lrt
+ $(CC) $(CFLAGS) -o $@ $< xdg-shell-protocol.c -lwayland-client -lrt $(LDFLAGS)
+ strip --strip-all wayland
.c.au:
$(CC) $(CFLAGS) -o $* $< -lm
@@ -24,5 +27,4 @@ wayland: wayland.c xdg-shell-protocol.c
.PHONY: clean
clean:
- rm SDL_YUV_visualisation
- rm wayland
+ rm SDL_YUV_visualisation wayland