parent
65d54d03a7
commit
a5a53efd64
2 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
|
|
12
Makefile
12
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
|
||||
|
|
Loading…
Reference in a new issue