Make polishing

This commit is contained in:
Imbus 2024-04-08 01:14:45 +02:00
parent 7c747ad404
commit 5f94263789

View file

@ -22,9 +22,11 @@ CFLAGS += -Wno-unused-macros
CFLAGS += -O3 CFLAGS += -O3
CFLAGS += -g CFLAGS += -g
GITHASH = $(shell git rev-parse --short HEAD)
# Specify the target binary (call it whatever) # Specify the target binary (call it whatever)
TARGET = build/bin.elf TARGET = build/program
TARGET_TAR = $(TARGET).tar.zst TARGET_TAR = $(TARGET)-$(GITHASH).tar.zst
TARGET_SIG = $(TARGET_TAR).minisig TARGET_SIG = $(TARGET_TAR).minisig
SRCS := $(wildcard src/*.c) SRCS := $(wildcard src/*.c)
@ -34,18 +36,11 @@ OBJS := $(patsubst src/%.c,build/%.o,$(SRCS))
all: $(TARGET) all: $(TARGET)
release : $(TARGET)
@strip $(TARGET)
@upx -q --force-overwrite $(TARGET) -o $(TARGET).upx > /dev/null
@minisign -Sm $(TARGET)
@tar --zstd -cvf $(TARGET).tar.zst $(TARGET) $(TARGET).minisig 1>/dev/null
@zip $(TARGET).zip $(TARGET) $(TARGET).minisig 1>/dev/null
@7za a $(TARGET).7z $(TARGET) $(TARGET).minisig 1>/dev/null
# For convenience # For convenience
run: $(TARGET) run: $(TARGET)
@./$(TARGET) @./$(TARGET)
# Create the build directory
mkbuilddir: mkbuilddir:
@mkdir -p build @mkdir -p build
@ -70,7 +65,10 @@ clean :
rm -f $(TARGET)* rm -f $(TARGET)*
# Create a signed release # Create a signed release
tar: $(TARGET_TAR) $(TARGET_SIG) tar: $(TARGET_TAR)
# Sign the tar
sign: $(TARGET_SIG)
$(TARGET_SIG): $(TARGET_TAR) $(TARGET_SIG): $(TARGET_TAR)
minisign -Sm $< minisign -Sm $<
@ -79,4 +77,4 @@ $(TARGET_TAR): $(TARGET)
strip $< strip $<
tar --zstd -cvf $@ $< tar --zstd -cvf $@ $<
.PHONY : all clean size mkbuilddir run gdb .PHONY: all clean size mkbuilddir run tar sign