From 2ca86229d50b7c3b46535ff53dba4eeee81459f7 Mon Sep 17 00:00:00 2001 From: ALittlePatate Date: Thu, 18 Jan 2024 16:05:56 +0100 Subject: [PATCH] fix: file structure, building to build/ --- Makefile | 20 +++++++++---------- api.c => src/api.c | 0 api.h => src/api.h | 0 file_utils.c => src/file_utils.c | 0 file_utils.h => src/file_utils.h | 0 instructions.c => src/instructions.c | 0 instructions.h => src/instructions.h | 0 .../interpreter_states.c | 0 .../interpreter_states.h | 0 pasm.c => src/pasm.c | 0 10 files changed, 10 insertions(+), 10 deletions(-) rename api.c => src/api.c (100%) rename api.h => src/api.h (100%) rename file_utils.c => src/file_utils.c (100%) rename file_utils.h => src/file_utils.h (100%) rename instructions.c => src/instructions.c (100%) rename instructions.h => src/instructions.h (100%) rename interpreter_states.c => src/interpreter_states.c (100%) rename interpreter_states.h => src/interpreter_states.h (100%) rename pasm.c => src/pasm.c (100%) diff --git a/Makefile b/Makefile index 5e552e6..8c22b0b 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ -SRC = pasm.c \ - file_utils.c \ - interpreter_states.c \ - instructions.c \ - api.c +SRC = src/pasm.c \ + src/file_utils.c \ + src/interpreter_states.c \ + src/instructions.c \ + src/api.c OBJ = $(SRC:.c=.o) NAME = pasm CFLAGS = -Wall -Wextra -Wpedantic -Iinclude @@ -11,13 +11,14 @@ CLIBS = all: $(NAME) lib: $(OBJ) - ar rc lib$(NAME).a $(OBJ) + mkdir build + ar rc build/lib$(NAME).a $(OBJ) $(NAME): fclean $(NAME): lib -$(NAME): CLIBS += lib$(NAME).a +$(NAME): CLIBS += build/lib$(NAME).a $(NAME): - gcc tests/interpreter.c $(CFLAGS) $(CLIBS) -o $(NAME) + gcc tests/interpreter.c $(CFLAGS) $(CLIBS) -o build/$(NAME) interpreter: $(NAME) @@ -30,8 +31,7 @@ clean: cd tests && $(MAKE) clean fclean: clean - rm -f $(NAME) - find . -name "lib$(NAME).a" -delete + rm -rf build/ cd tests && $(MAKE) fclean re: fclean diff --git a/api.c b/src/api.c similarity index 100% rename from api.c rename to src/api.c diff --git a/api.h b/src/api.h similarity index 100% rename from api.h rename to src/api.h diff --git a/file_utils.c b/src/file_utils.c similarity index 100% rename from file_utils.c rename to src/file_utils.c diff --git a/file_utils.h b/src/file_utils.h similarity index 100% rename from file_utils.h rename to src/file_utils.h diff --git a/instructions.c b/src/instructions.c similarity index 100% rename from instructions.c rename to src/instructions.c diff --git a/instructions.h b/src/instructions.h similarity index 100% rename from instructions.h rename to src/instructions.h diff --git a/interpreter_states.c b/src/interpreter_states.c similarity index 100% rename from interpreter_states.c rename to src/interpreter_states.c diff --git a/interpreter_states.h b/src/interpreter_states.h similarity index 100% rename from interpreter_states.h rename to src/interpreter_states.h diff --git a/pasm.c b/src/pasm.c similarity index 100% rename from pasm.c rename to src/pasm.c