r0nk wanted more configurable knobs, so here's adding selection of individual source files
This commit is contained in:
parent
2f984857f2
commit
67a70f4acf
@ -20,6 +20,7 @@ ifeq ($(OS),Windows_NT)
|
||||
endif
|
||||
|
||||
SOURCE_DIRS::=src
|
||||
SOURCES::=
|
||||
OBJDIR::=obj
|
||||
DEPDIR::=$(OBJDIR)/dep
|
||||
LIBDIR::=lib
|
||||
@ -116,8 +117,8 @@ endif
|
||||
#add dependency tracking and include directories
|
||||
INTERNAL_COMPILERFLAGS=-c $(foreach dir,$(INCLUDE_DIRS),-I"$(dir)") -MMD -MP -MF"$(DEPDIR)/$(notdir $(patsubst %.o,%.d,$@))"
|
||||
THIS_MAKEFILE_NAME::=$(lastword $(MAKEFILE_LIST))
|
||||
SOURCES::=$(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
||||
OBJECTS::=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(SOURCES)))))
|
||||
INTERNAL_SOURCES::=$(SOURCES) $(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
||||
OBJECTS::=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(INTERNAL_SOURCES)))))
|
||||
|
||||
#Arguments to make submake use this makefile without "Entering directory" stuff
|
||||
SUBMAKE_ARGUMENTS::=--no-print-directory -f "$(THIS_MAKEFILE_NAME)"
|
||||
@ -148,9 +149,14 @@ define GENERATE_OBJECTS
|
||||
$$(OBJDIR)/$(subst \,.,$(subst /,.,$(1))).%.o: $(1)/%
|
||||
$$(COMPILER) $$(COMPILER_FLAGS) $$(INTERNAL_COMPILERFLAGS) "$$<" -o "$$@"
|
||||
endef
|
||||
define GENERATE_INDIVIDUAL_OBJECTS
|
||||
$$(OBJDIR)/$(subst \,.,$(subst /,.,$(1))).o: $(1)
|
||||
$$(COMPILER) $$(COMPILER_FLAGS) $$(INTERNAL_COMPILERFLAGS) "$$<" -o "$$@"
|
||||
endef
|
||||
|
||||
#Create targets for object files
|
||||
$(foreach dir,$(SOURCE_DIRS),$(eval $(call GENERATE_OBJECTS,$(dir))))
|
||||
$(foreach src,$(SOURCES),$(eval $(call GENERATE_INDIVIDUAL_OBJECTS,$(src))))
|
||||
$(OBJECTS): | $(OBJDIR) $(DEPDIR)
|
||||
|
||||
#Output directory creation
|
||||
|
||||
@ -20,6 +20,7 @@ ifeq ($(OS),Windows_NT)
|
||||
endif
|
||||
|
||||
SOURCE_DIRS::=src
|
||||
SOURCES::=
|
||||
OBJDIR::=obj
|
||||
DEPDIR::=$(OBJDIR)/dep
|
||||
LIBDIR::=lib
|
||||
@ -127,8 +128,8 @@ ifeq ($(SHARED),1)
|
||||
INTERNAL_COMPILERFLAGS+=$(SHARED_LIBRARY_FLAGS)
|
||||
endif
|
||||
THIS_MAKEFILE_NAME::=$(lastword $(MAKEFILE_LIST))
|
||||
SOURCES::=$(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
||||
OBJECTS::=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(SOURCES)))))
|
||||
INTERNAL_SOURCES::=$(SOURCES) $(foreach source,$(SOURCE_DIRS),$(foreach ext,$(EXT),$(wildcard $(source)/*.$(ext))))
|
||||
OBJECTS::=$(addprefix $(OBJDIR)/,$(subst \,.,$(subst /,.,$(addsuffix .o,$(INTERNAL_SOURCES)))))
|
||||
|
||||
#Arguments to make submake use this makefile without "Entering directory" stuff
|
||||
SUBMAKE_ARGUMENTS::=--no-print-directory -f "$(THIS_MAKEFILE_NAME)"
|
||||
@ -189,9 +190,15 @@ define GENERATE_OBJECTS
|
||||
$$(OBJDIR)/$(subst \,.,$(subst /,.,$(1))).%.o: $(1)/%
|
||||
$$(COMPILER) $$(COMPILER_FLAGS) $$(INTERNAL_COMPILERFLAGS) "$$<" -o "$$@"
|
||||
endef
|
||||
define GENERATE_INDIVIDUAL_OBJECTS
|
||||
$$(OBJDIR)/$(subst \,.,$(subst /,.,$(1))).o: $(1)
|
||||
$$(COMPILER) $$(COMPILER_FLAGS) $$(INTERNAL_COMPILERFLAGS) "$$<" -o "$$@"
|
||||
endef
|
||||
|
||||
|
||||
#Create targets for object files
|
||||
$(foreach dir,$(SOURCE_DIRS),$(eval $(call GENERATE_OBJECTS,$(dir))))
|
||||
$(foreach src,$(SOURCES),$(eval $(call GENERATE_INDIVIDUAL_OBJECTS,$(src))))
|
||||
$(OBJECTS): | $(OBJDIR) $(DEPDIR)
|
||||
|
||||
$(OBJDIR):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user