aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile17
1 files changed, 13 insertions, 4 deletions
diff --git a/Makefile b/Makefile
index f4e0a45..d3a7999 100644
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,24 @@
include config.mk
-CC = diet -Os gcc
+CC = diet -Os clang
+LD = diet clang
OBJ = sinit.o
BIN = sinit
-CFLAGS = -Os -flto -s -fno-asynchronous-unwind-tables -fno-unwind-tables
-LDFLAGS = -flto -Os -static -Wl,--gc-sections -Wl,--strip-all -Wl,-z,norelro -fno-asynchronous-unwind-tables -Wl,--build-id=none
+CFLAGS = -Oz -flto -fno-asynchronous-unwind-tables -fno-unwind-tables -ffunction-sections -fdata-sections
+LDFLAGS = -flto -O2 -static -Wl,--gc-sections -Wl,--strip-all -Wl,-z,norelro -fno-asynchronous-unwind-tables -Wl,--build-id=none
all: $(BIN) poweroff reboot
+reboot: reboot.o
+ $(LD) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
+ strip -R .comment -R .jcr -R .eh_data -R .note -R .eh_frame $@
+
+poweroff: poweroff.o
+ $(LD) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
+ strip -R .comment -R .jcr -R .eh_data -R .note -R .eh_frame $@
+
$(BIN): $(OBJ)
- $(CC) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
+ $(LD) $(LDFLAGS) -o $@ $(OBJ) $(LDLIBS)
strip -R .comment -R .jcr -R .eh_data -R .note -R .eh_frame $@
$(OBJ): config.h