From a5a53efd64ba14791915ed855b9bbf8d6ac9fe08 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sat, 19 Oct 2024 15:08:51 +0200 Subject: [PATCH] hello --- .forgejo/workflows/build.yml | 2 +- Makefile | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.forgejo/workflows/build.yml b/.forgejo/workflows/build.yml index fe3c9f4..e3cefbb 100644 --- a/.forgejo/workflows/build.yml +++ b/.forgejo/workflows/build.yml @@ -10,7 +10,7 @@ jobs: - name: Install toolchain run: apt install -y gcc-x86-64-linux-gnu gcc-aarch64-linux-gnu make - name: Install dependencies - run: apt install -y elfutils + run: apt install -y libelf-dev - name: Clone repository run: git clone https://git.m724.eu/Minecon724/criscv.git . - name: Package for x86_64 diff --git a/Makefile b/Makefile index 7e37940..13c758b 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,8 @@ # Compiler to use CC ?= gcc -BASE_CFLAGS := -Wall -Wextra -std=gnu23 -I include +CFLAGS = -Wall -Wextra -std=gnu23 -I include +LDFLAGS = -lelf # Directory for build outputs BUILD_DIR := build @@ -20,20 +21,19 @@ TARGET := $(BUILD_DIR)/$(PROGRAM_NAME) # Default target: build the executable -all: CFLAGS := $(BASE_CFLAGS) -O3 -lelf +all: CFLAGS += -O3 all: $(TARGET) # Debug target -debug: CFLAGS := $(BASE_CFLAGS) -O0 -g -lelf +debug: CFLAGS += -O0 -g debug: $(TARGET) # Declare 'all' and 'clean' as phony targets (not files) -.PHONY: all debug static clean - +.PHONY: all debug clean # Rule to link object files into the final executable $(TARGET): $(OBJS) | $(BUILD_DIR) - $(CC) $(CFLAGS) $^ -o $@ + $(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@ du -b $(TARGET) # Size of the executable in bytes # Rule to compile source files into object files