Add Makefile, gitignore and (empty-ish) source files
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
build
|
||||||
|
tests
|
||||||
|
*.txt
|
47
Makefile
Normal file
47
Makefile
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
DIR_SRC := src
|
||||||
|
DIR_BLD := build
|
||||||
|
DIR_BIN := $(DIR_BLD)/bin
|
||||||
|
|
||||||
|
OBJS := $(DIR_BLD)/tests.o \
|
||||||
|
$(DIR_BLD)/constants.o \
|
||||||
|
$(DIR_BLD)/core.o \
|
||||||
|
$(DIR_BLD)/console.o \
|
||||||
|
$(DIR_BLD)/string.o \
|
||||||
|
$(DIR_BLD)/convert.o
|
||||||
|
OBJS_LST := false
|
||||||
|
SRCS := $(patsubst $(DIR_BLD)/%.o,$(SRC_DIR)/%.asm,$(OBJS))
|
||||||
|
|
||||||
|
COMPILER := nasm
|
||||||
|
COMPILER_FLAGS := -f elf64
|
||||||
|
COMPILER_FLAGS_D := -f elf64 -g -F dwarf
|
||||||
|
LINKER := ld
|
||||||
|
LINKER_FLAGS := -no-pie -z noexecstack -Ox
|
||||||
|
|
||||||
|
.PHONY: all clean debug
|
||||||
|
|
||||||
|
all: $(DIR_BIN)/tests
|
||||||
|
|
||||||
|
$(DIR_BIN)/tests: $(OBJS)
|
||||||
|
@mkdir -p $(DIR_BIN)
|
||||||
|
$(LINKER) $^ -o $@ $(LINKER_FLAGS)
|
||||||
|
ln -sf $@ tests
|
||||||
|
$(DIR_BLD)/%.o: $(DIR_SRC)/%.asm
|
||||||
|
@mkdir -p $(DIR_BLD)
|
||||||
|
@LST=$(basename $@).lst; \
|
||||||
|
if [ "$(OBJS_LST)" = "true" ]; then \
|
||||||
|
$(COMPILER) $< $(COMPILER_FLAGS) -l $$LST -o $@; \
|
||||||
|
echo $(COMPILER) $< $(COMPILER_FLAGS) -l $$LST -o $@; \
|
||||||
|
else \
|
||||||
|
$(COMPILER) $< $(COMPILER_FLAGS) -o $@; \
|
||||||
|
echo $(COMPILER) $< $(COMPILER_FLAGS) -o $@; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -rf $(DIR_BLD) tests
|
||||||
|
|
||||||
|
debug: COMPILER_FLAGS = $(COMPILER_FLAGS_D)
|
||||||
|
debug: OBJS_LST := true
|
||||||
|
debug: clean $(OBJS)
|
||||||
|
@mkdir -p $(DIR_BIN)
|
||||||
|
$(LINKER) $(OBJS) -o $(DIR_BIN)/tests $(LINKER_FLAGS)
|
||||||
|
ln -sf $(DIR_BIN)/tests tests
|
@@ -1,2 +1,2 @@
|
|||||||
Minimal C-like library written in x64 assembly (Intel 64) - let's call it C-.
|
Minimal C-like library written in x64 assembly (Intel 64) - let's call it C- and/or klibc.
|
||||||
NOT usable for production - written for study purposes only.
|
NOT usable for production - written for study purposes only.
|
||||||
|
1
src/console.asm
Normal file
1
src/console.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
%include "src/constants.asm"
|
1
src/constants.asm
Normal file
1
src/constants.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
section .rodata
|
1
src/convert.asm
Normal file
1
src/convert.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
%include "src/constants.asm"
|
1
src/core.asm
Normal file
1
src/core.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
%include "src/constants.asm"
|
1
src/string.asm
Normal file
1
src/string.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
%include "src/constants.asm"
|
1
src/tests.asm
Normal file
1
src/tests.asm
Normal file
@@ -0,0 +1 @@
|
|||||||
|
%include "src/constants.asm"
|
Reference in New Issue
Block a user