From d3d833d4a60532f6a4f0621b1964995366b7269b Mon Sep 17 00:00:00 2001 From: Jaby Date: Sun, 21 Aug 2022 19:30:49 +0200 Subject: [PATCH] Build library --- .gitignore | 2 +- Makefile => lib/Makefile | 11 ++++------- lib/Wildcard.mk | 2 ++ src/Library/Makefile | 5 ++++- 4 files changed, 11 insertions(+), 9 deletions(-) rename Makefile => lib/Makefile (89%) create mode 100644 lib/Wildcard.mk diff --git a/.gitignore b/.gitignore index 693c439e..948f52e5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ **/iso/Info /iso -*.dep +*.d *.a *.o *.ii diff --git a/Makefile b/lib/Makefile similarity index 89% rename from Makefile rename to lib/Makefile index a3a3fdb5..88675838 100644 --- a/Makefile +++ b/lib/Makefile @@ -19,10 +19,10 @@ PREFIX ?= mipsel-none-elf FORMAT ?= elf32-littlemips endif -CC ?= $(PREFIX)-gcc-10 -CXX ?= $(PREFIX)-g++-10 -LD ?= $(CXX) -AR ?= ar +CC = $(PREFIX)-gcc-10 +CXX = $(PREFIX)-g++-10 +LD = $(CXX) +AR = ar #architecture flags ARCHFLAGS = -march=mips1 -mabi=32 -EL -fno-pic -mno-shared -mno-abicalls -mfp32 @@ -55,9 +55,6 @@ LIBS_all += $(LIBS_$(BUILD_PROFILE)) DEPS = -Wp,-MMD,$(@:%.o=%.d),-MT,$@ -#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp -rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2)) - #Object files list OBJS = $(addprefix $(OUTPUT_DIR)/,$(addsuffix .o, $(subst ..,!super,$(basename $(SRCS))))) diff --git a/lib/Wildcard.mk b/lib/Wildcard.mk new file mode 100644 index 00000000..d86f7509 --- /dev/null +++ b/lib/Wildcard.mk @@ -0,0 +1,2 @@ +#Macro to expand files recursively: parameters $1 - directory, $2 - extension, i.e. cpp +rwildcard = $(wildcard $(addprefix $1/*.,$2)) $(foreach d,$(wildcard $1/*),$(call rwildcard,$d,$2)) \ No newline at end of file diff --git a/src/Library/Makefile b/src/Library/Makefile index d178c6fb..cfad36fe 100644 --- a/src/Library/Makefile +++ b/src/Library/Makefile @@ -1,7 +1,10 @@ ARTIFACT = libJabyEngine BUILD_DIR = ../../lib -include ../../Makefile +include ../../lib/Wildcard.mk +SRCS = $(call rwildcard, src, c cpp) + +include ../../lib/Makefile #Rules section for default compilation and linking all: $(TARGET).a