Add Library build target and Fix Rebuild issues
This commit is contained in:
@@ -47,14 +47,18 @@ LOCALDEPENDS = $(LOCALOBJECTS:.o.$(ARCH)=.d.$(ARCH))
|
||||
SOURCES = $(wildcard *.cpp */*.cpp */*/*.cpp */*/*/*.cpp)
|
||||
FILTER = Libraries%
|
||||
SOURCES := $(filter-out $(FILTER),$(SOURCES))
|
||||
OBJECTS = $(SOURCES:.cpp=.o.$(ARCH))
|
||||
DEPENDS = $(OBJECTS:.o.$(ARCH)=.d.$(ARCH))
|
||||
REALOBJECTS := $(SOURCES:.cpp=.o.$(ARCH))
|
||||
DEPENDS = $(REALOBJECTS:.o.$(ARCH)=.d.$(ARCH))
|
||||
OBJECTS := RECURSIVE_PHONY
|
||||
OBJECTS += $(REALOBJECTS)
|
||||
LIBRARIES =
|
||||
LIBFILES =
|
||||
TARGETS =
|
||||
|
||||
# ---------- Recursive Targets ----------
|
||||
|
||||
.PHONY: RECURSIVE_PHONY
|
||||
|
||||
$(LOCALOBJECTS): | $(SUBDIRS)
|
||||
$(OBJECTS): | $(SUBDIRS)
|
||||
|
||||
@@ -78,6 +82,11 @@ define build_target_library_arch
|
||||
@mv $(1) $$(echo $(ROOTPATH)/lib/$(ARCH)/lib$(1) | sed 's/\.$(ARCH)//g')
|
||||
endef
|
||||
|
||||
define add_target_library_arch
|
||||
$(1).$(ARCH): $$(OBJECTS) $$(LIBFILES)
|
||||
$$(call build_target_library_arch,$$@,$$(REALOBJECTS) $$(LIBFILES))
|
||||
endef
|
||||
|
||||
define add_library
|
||||
LIBFILES += $(ROOTPATH)/Libraries/$(1)/lib/$(ARCH)/lib$(1).a
|
||||
LFLAGS += -l$(1)
|
||||
@@ -113,16 +122,31 @@ define build_target
|
||||
fi
|
||||
endef
|
||||
|
||||
define add_target_test_arch
|
||||
$(1).$(ARCH): $$(OBJECTS) $$(LIBFILES) Test/Test.o.$(ARCH)
|
||||
$$(call build_target_arch,$$@,$$(REALOBJECTS) $$(LIBFILES) Test/Test.o.$(ARCH))
|
||||
endef
|
||||
|
||||
define add_target_arch
|
||||
$(1).$(ARCH): $$(OBJECTS) $$(LIBFILES) Application/$(strip $(1)).o.$(ARCH)
|
||||
$$(call build_target_arch,$$@,$$^)
|
||||
$$(call build_target_arch,$$@,$$(REALOBJECTS) $$(LIBFILES) Application/$(strip $(1)).o.$(ARCH))
|
||||
endef
|
||||
|
||||
define add_target
|
||||
ifeq ($(.DEFAULT_GOAL),artifacts)
|
||||
.DEFAULT_GOAL := $(1)
|
||||
endif
|
||||
$(eval $(call add_target_arch, $(1)))
|
||||
|
||||
ifneq (,$$(findstring .a,$(1)))
|
||||
$$(eval $$(call add_target_library_arch, $(1)))
|
||||
else
|
||||
ifeq ($(1),test)
|
||||
$$(eval $$(call add_target_test_arch, $(1)))
|
||||
else
|
||||
$$(eval $$(call add_target_arch, $(1)))
|
||||
endif
|
||||
endif
|
||||
|
||||
$(1):
|
||||
$$(call build_target,$$@)
|
||||
endef
|
||||
|
||||
Reference in New Issue
Block a user