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)
|
SOURCES = $(wildcard *.cpp */*.cpp */*/*.cpp */*/*/*.cpp)
|
||||||
FILTER = Libraries%
|
FILTER = Libraries%
|
||||||
SOURCES := $(filter-out $(FILTER),$(SOURCES))
|
SOURCES := $(filter-out $(FILTER),$(SOURCES))
|
||||||
OBJECTS = $(SOURCES:.cpp=.o.$(ARCH))
|
REALOBJECTS := $(SOURCES:.cpp=.o.$(ARCH))
|
||||||
DEPENDS = $(OBJECTS:.o.$(ARCH)=.d.$(ARCH))
|
DEPENDS = $(REALOBJECTS:.o.$(ARCH)=.d.$(ARCH))
|
||||||
|
OBJECTS := RECURSIVE_PHONY
|
||||||
|
OBJECTS += $(REALOBJECTS)
|
||||||
LIBRARIES =
|
LIBRARIES =
|
||||||
LIBFILES =
|
LIBFILES =
|
||||||
TARGETS =
|
TARGETS =
|
||||||
|
|
||||||
# ---------- Recursive Targets ----------
|
# ---------- Recursive Targets ----------
|
||||||
|
|
||||||
|
.PHONY: RECURSIVE_PHONY
|
||||||
|
|
||||||
$(LOCALOBJECTS): | $(SUBDIRS)
|
$(LOCALOBJECTS): | $(SUBDIRS)
|
||||||
$(OBJECTS): | $(SUBDIRS)
|
$(OBJECTS): | $(SUBDIRS)
|
||||||
|
|
||||||
@@ -78,6 +82,11 @@ define build_target_library_arch
|
|||||||
@mv $(1) $$(echo $(ROOTPATH)/lib/$(ARCH)/lib$(1) | sed 's/\.$(ARCH)//g')
|
@mv $(1) $$(echo $(ROOTPATH)/lib/$(ARCH)/lib$(1) | sed 's/\.$(ARCH)//g')
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define add_target_library_arch
|
||||||
|
$(1).$(ARCH): $$(OBJECTS) $$(LIBFILES)
|
||||||
|
$$(call build_target_library_arch,$$@,$$(REALOBJECTS) $$(LIBFILES))
|
||||||
|
endef
|
||||||
|
|
||||||
define add_library
|
define add_library
|
||||||
LIBFILES += $(ROOTPATH)/Libraries/$(1)/lib/$(ARCH)/lib$(1).a
|
LIBFILES += $(ROOTPATH)/Libraries/$(1)/lib/$(ARCH)/lib$(1).a
|
||||||
LFLAGS += -l$(1)
|
LFLAGS += -l$(1)
|
||||||
@@ -113,16 +122,31 @@ define build_target
|
|||||||
fi
|
fi
|
||||||
endef
|
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
|
define add_target_arch
|
||||||
$(1).$(ARCH): $$(OBJECTS) $$(LIBFILES) Application/$(strip $(1)).o.$(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
|
endef
|
||||||
|
|
||||||
define add_target
|
define add_target
|
||||||
ifeq ($(.DEFAULT_GOAL),artifacts)
|
ifeq ($(.DEFAULT_GOAL),artifacts)
|
||||||
.DEFAULT_GOAL := $(1)
|
.DEFAULT_GOAL := $(1)
|
||||||
endif
|
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):
|
$(1):
|
||||||
$$(call build_target,$$@)
|
$$(call build_target,$$@)
|
||||||
endef
|
endef
|
||||||
|
|||||||
Reference in New Issue
Block a user