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