parent
65d54d03a7
commit
a5a53efd64
2 changed files with 7 additions and 7 deletions
|
@ -10,7 +10,7 @@ jobs:
|
||||||
- name: Install toolchain
|
- name: Install toolchain
|
||||||
run: apt install -y gcc-x86-64-linux-gnu gcc-aarch64-linux-gnu make
|
run: apt install -y gcc-x86-64-linux-gnu gcc-aarch64-linux-gnu make
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: apt install -y elfutils
|
run: apt install -y libelf-dev
|
||||||
- name: Clone repository
|
- name: Clone repository
|
||||||
run: git clone https://git.m724.eu/Minecon724/criscv.git .
|
run: git clone https://git.m724.eu/Minecon724/criscv.git .
|
||||||
- name: Package for x86_64
|
- name: Package for x86_64
|
||||||
|
|
12
Makefile
12
Makefile
|
@ -1,7 +1,8 @@
|
||||||
# Compiler to use
|
# Compiler to use
|
||||||
CC ?= gcc
|
CC ?= gcc
|
||||||
|
|
||||||
BASE_CFLAGS := -Wall -Wextra -std=gnu23 -I include
|
CFLAGS = -Wall -Wextra -std=gnu23 -I include
|
||||||
|
LDFLAGS = -lelf
|
||||||
|
|
||||||
# Directory for build outputs
|
# Directory for build outputs
|
||||||
BUILD_DIR := build
|
BUILD_DIR := build
|
||||||
|
@ -20,20 +21,19 @@ TARGET := $(BUILD_DIR)/$(PROGRAM_NAME)
|
||||||
|
|
||||||
|
|
||||||
# Default target: build the executable
|
# Default target: build the executable
|
||||||
all: CFLAGS := $(BASE_CFLAGS) -O3 -lelf
|
all: CFLAGS += -O3
|
||||||
all: $(TARGET)
|
all: $(TARGET)
|
||||||
|
|
||||||
# Debug target
|
# Debug target
|
||||||
debug: CFLAGS := $(BASE_CFLAGS) -O0 -g -lelf
|
debug: CFLAGS += -O0 -g
|
||||||
debug: $(TARGET)
|
debug: $(TARGET)
|
||||||
|
|
||||||
# Declare 'all' and 'clean' as phony targets (not files)
|
# 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
|
# Rule to link object files into the final executable
|
||||||
$(TARGET): $(OBJS) | $(BUILD_DIR)
|
$(TARGET): $(OBJS) | $(BUILD_DIR)
|
||||||
$(CC) $(CFLAGS) $^ -o $@
|
$(CC) $(CFLAGS) $^ $(LDFLAGS) -o $@
|
||||||
du -b $(TARGET) # Size of the executable in bytes
|
du -b $(TARGET) # Size of the executable in bytes
|
||||||
|
|
||||||
# Rule to compile source files into object files
|
# Rule to compile source files into object files
|
||||||
|
|
Loading…
Reference in a new issue