build: add address sanitizer make target (#9044)

pull/9189/head
pancake 2021-03-07 16:44:54 +01:00 committed by GitHub
parent 4c3ce97763
commit ed9ca0b7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 28 deletions

View File

@ -73,36 +73,21 @@ endif
.PHONY: all clean fresh_vc fresh_tcc .PHONY: all clean fresh_vc fresh_tcc
ifdef prod
VFLAGS+=-prod
endif
all: latest_vc latest_tcc all: latest_vc latest_tcc
ifdef WIN32 ifdef WIN32
$(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS) $(CC) $(CFLAGS) -g -std=c99 -municode -w -o $(V) $(VC)/$(VCFILE) $(LDFLAGS)
ifdef prod
$(V) -prod self
else
$(V) self $(V) self
endif
else else
$(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS) $(CC) $(CFLAGS) -g -std=gnu99 -w -o $(V) $(VC)/$(VCFILE) -lm -lpthread $(LDFLAGS)
ifdef ANDROID
chmod 755 v
endif
ifdef prod
$(V) -prod self
else
$(V) self $(V) self
endif
ifndef ANDROID
$(MAKE) modules
endif
endif endif
@echo "V has been successfully built" @echo "V has been successfully built"
@$(V) -version @$(V) -version
#clean: clean_tmp
#git clean -xf
clean: clean:
rm -rf $(TMPTCC) rm -rf $(TMPTCC)
rm -rf $(VC) rm -rf $(VC)
@ -143,16 +128,11 @@ $(TMPTCC)/.git/config:
$(VC)/.git/config: $(VC)/.git/config:
$(MAKE) fresh_vc $(MAKE) fresh_vc
asan:
$(MAKE) all CFLAGS='-fsanitize=address,undefined'
selfcompile: selfcompile:
$(V) -cg -o v cmd/v $(V) -cg -o v cmd/v
selfcompile-static: selfcompile-static:
$(V) -cg -cflags '--static' -o v-static cmd/v $(V) -cg -cflags '--static' -o v-static cmd/v
modules: module_builtin module_strings module_strconv
module_builtin:
#$(V) build module vlib/builtin > /dev/null
module_strings:
#$(V) build module vlib/strings > /dev/null
module_strconv:
#$(V) build module vlib/strconv > /dev/null

View File

@ -406,7 +406,7 @@ pub fn join_env_vflags_and_os_args() []string {
} }
return non_empty(args) return non_empty(args)
} }
return non_empty(os.args) return os.args
} }
fn non_empty(arg []string) []string { fn non_empty(arg []string) []string {