26 lines
422 B
Makefile
26 lines
422 B
Makefile
# Makefile: Compile and link main.asm using nasm and mold, intermediate files in target/
|
|
|
|
TARGET_DIR := target
|
|
SRC := src/main.asm
|
|
OBJ := $(TARGET_DIR)/main.o
|
|
BIN := $(TARGET_DIR)/main
|
|
|
|
.PHONY: all clean
|
|
|
|
all: $(BIN)
|
|
|
|
$(TARGET_DIR):
|
|
mkdir -p $(TARGET_DIR)
|
|
|
|
$(OBJ): $(SRC) | $(TARGET_DIR)
|
|
nasm -f elf64 -g $(SRC) -o $(OBJ)
|
|
|
|
$(BIN): $(OBJ)
|
|
mold -run ld -o $(BIN) $(OBJ)
|
|
|
|
run: $(BIN)
|
|
$(BIN)
|
|
|
|
clean:
|
|
rm -rf $(TARGET_DIR)
|