Hopefully actually fix rust build
This commit is contained in:
parent
d4f7e5e601
commit
634881f00b
@ -25,7 +25,8 @@ LIBDIRS::=lib
|
|||||||
LDLIBS::=
|
LDLIBS::=
|
||||||
LDFLAGS::=
|
LDFLAGS::=
|
||||||
RUSTFLAGS::=
|
RUSTFLAGS::=
|
||||||
DEBUG_RUSTFLAGS::=
|
DEBUG_RUSTFLAGS::=$(RUSTFLAGS) -g
|
||||||
|
RELEASE_RUSTFLAGS::=$(RUSTFLAGS) -O
|
||||||
MAIN_EXECUTABLE::=tester
|
MAIN_EXECUTABLE::=tester
|
||||||
RELEASE?=0
|
RELEASE?=0
|
||||||
SAVEFLAGS?=1
|
SAVEFLAGS?=1
|
||||||
@ -42,7 +43,7 @@ endif
|
|||||||
all::
|
all::
|
||||||
|
|
||||||
#main target
|
#main target
|
||||||
all:: $(MAIN_EXECUTABLE) $(MAIN_DEP_FILE)
|
all:: $(MAIN_EXECUTABLE)
|
||||||
|
|
||||||
#postrun targets
|
#postrun targets
|
||||||
all::
|
all::
|
||||||
@ -76,16 +77,12 @@ endif
|
|||||||
#Rust is weird and should only need one depfile for a whole project since the compiler auto imports stuff
|
#Rust is weird and should only need one depfile for a whole project since the compiler auto imports stuff
|
||||||
MAIN_DEP_FILE::=$(DEPDIR)/$(notdir $(addsuffix .d,$(MAIN_SOURCE_FILE)))
|
MAIN_DEP_FILE::=$(DEPDIR)/$(notdir $(addsuffix .d,$(MAIN_SOURCE_FILE)))
|
||||||
|
|
||||||
ALL_LDFLAGS+=$(LDFLAGS) $(foreach dir,$(LIBDIRS),-L'$(dir)') $(foreach lib,$(LDLIBS),"--extern $(lib)")
|
|
||||||
|
|
||||||
ifneq ($(RELEASE),1)
|
|
||||||
RUSTFLAGS+=$(DEBUG_RUSTFLAGS)
|
|
||||||
endif
|
|
||||||
ifeq ($(RELEASE),1)
|
ifeq ($(RELEASE),1)
|
||||||
RUSTFLAGS+=-O
|
COMPILE_FLAGS::=$(RELEASE_RUSTFLAGS)
|
||||||
else
|
else
|
||||||
RUSTFLAGS+=-g
|
COMPILE_FLAGS::=$(DEBUG_RUSTFLAGS)
|
||||||
endif
|
endif
|
||||||
|
ALL_LDFLAGS+=$(LDFLAGS) $(foreach dir,$(LIBDIRS),-L'$(dir)') $(foreach lib,$(LDLIBS),"--extern $(lib)")
|
||||||
|
|
||||||
COMPILER::=$(RUSTC)
|
COMPILER::=$(RUSTC)
|
||||||
|
|
||||||
@ -100,10 +97,10 @@ endif
|
|||||||
ifeq ($(SAVEFLAGS),1)
|
ifeq ($(SAVEFLAGS),1)
|
||||||
|
|
||||||
#Check if compile flags have changed since last build
|
#Check if compile flags have changed since last build
|
||||||
ifneq ($(OLD_COMPILEFLAGS),$(RUSTFLAGS))
|
ifneq ($(OLD_COMPILEFLAGS),$(COMPILE_FLAGS))
|
||||||
.PHONY: $(RUSTFLAGS_TMPFILE)
|
.PHONY: $(RUSTFLAGS_TMPFILE)
|
||||||
$(RUSTFLAGS_TMPFILE):
|
$(RUSTFLAGS_TMPFILE):
|
||||||
$(file >$(RUSTFLAGS_TMPFILE),$(RUSTFLAGS))
|
$(file >$(RUSTFLAGS_TMPFILE),$(COMPILE_FLAGS))
|
||||||
else
|
else
|
||||||
$(RUSTFLAGS_TMPFILE):
|
$(RUSTFLAGS_TMPFILE):
|
||||||
endif
|
endif
|
||||||
@ -123,14 +120,14 @@ endif
|
|||||||
flags-update: rustflags-update ldflags-update
|
flags-update: rustflags-update ldflags-update
|
||||||
|
|
||||||
#Compile all the rust 'crates'
|
#Compile all the rust 'crates'
|
||||||
$(MAIN_EXECUTABLE): $(MAIN_SOURCE_FILE) $(LDFLAGS_TMPFILE) $(RUSTFLAGS_TMPFILE)
|
$(MAIN_EXECUTABLE): $(MAIN_SOURCE_FILE) $(LDFLAGS_TMPFILE) $(RUSTFLAGS_TMPFILE) $(MAIN_DEP_FILE)
|
||||||
$(COMPILER) $< $(RUSTFLAGS) -o $@ $(ALL_LDFLAGS)
|
$(COMPILER) $< $(COMPILE_FLAGS) -o $@ $(ALL_LDFLAGS)
|
||||||
ifeq ($(RELEASE),1)
|
ifeq ($(RELEASE),1)
|
||||||
$(STRIP) --strip-all "$(MAIN_EXECUTABLE)"
|
$(STRIP) --strip-all "$(MAIN_EXECUTABLE)"
|
||||||
endif
|
endif
|
||||||
#create a dependency tracking file so that the project rebuilds when any dep is updated
|
#create a dependency tracking file so that the project rebuilds when any dep is updated
|
||||||
$(MAIN_DEP_FILE): $(MAIN_SOURCE_FILE) $(RUSTFLAGS_TMPFILE) | $(DEPDIR)
|
$(MAIN_DEP_FILE): $(MAIN_SOURCE_FILE) $(RUSTFLAGS_TMPFILE) | $(DEPDIR)
|
||||||
$(COMPILER) $< --emit dep-info $(RUSTFLAGS) -o $@
|
$(COMPILER) $< --emit dep-info $(COMPILE_FLAGS) -o $@
|
||||||
|
|
||||||
$(DEPDIR):
|
$(DEPDIR):
|
||||||
$(call mkdir,"$(DEPDIR)")
|
$(call mkdir,"$(DEPDIR)")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user