comparison src/Make_cyg_ming.mak @ 29134:cc1f2ef46aaa v8.2.5087

patch 8.2.5087: cannot build with clang on MS-Windows Commit: https://github.com/vim/vim/commit/1630bd980a1f7f62adc6f73cb20be66a3c382225 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Jun 14 12:30:25 2022 +0100 patch 8.2.5087: cannot build with clang on MS-Windows Problem: Cannot build with clang on MS-Windows. Solution: Add support for building with clang. (Yegappan Lakshmanan, closes #10557)
author Bram Moolenaar <Bram@vim.org>
date Tue, 14 Jun 2022 13:45:03 +0200
parents ef7d9789919d
children 9288c636ffa5
comparison
equal deleted inserted replaced
29133:3e53cde225df 29134:cc1f2ef46aaa
215 DEL = del 215 DEL = del
216 MKDIR = mkdir 216 MKDIR = mkdir
217 DIRSLASH = \\ 217 DIRSLASH = \\
218 endif 218 endif
219 endif 219 endif
220 ifeq ($(CC),)
220 CC := $(CROSS_COMPILE)gcc 221 CC := $(CROSS_COMPILE)gcc
222 endif
223 ifeq ($(CXX),)
221 CXX := $(CROSS_COMPILE)g++ 224 CXX := $(CROSS_COMPILE)g++
225 endif
222 ifeq ($(UNDER_CYGWIN),yes) 226 ifeq ($(UNDER_CYGWIN),yes)
223 WINDRES := $(CROSS_COMPILE)windres 227 WINDRES := $(CROSS_COMPILE)windres
224 else 228 else
225 WINDRES := windres 229 WINDRES := windres
226 endif 230 endif
518 522
519 #>>>>> end of choices 523 #>>>>> end of choices
520 ########################################################################### 524 ###########################################################################
521 525
522 CFLAGS = -I. -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall 526 CFLAGS = -I. -Iproto $(DEFINES) -pipe -march=$(ARCH) -Wall
527 # To get additional compiler warnings
528 #CFLAGS += -Wextra -pedantic
523 CXXFLAGS = -std=gnu++11 529 CXXFLAGS = -std=gnu++11
524 # This used to have --preprocessor, but it's no longer supported 530 # This used to have --preprocessor, but it's no longer supported
525 WINDRES_FLAGS = 531 WINDRES_FLAGS =
526 EXTRA_LIBS = 532 EXTRA_LIBS =
527 533
720 else 726 else
721 ifeq ($(OPTIMIZE), SIZE) 727 ifeq ($(OPTIMIZE), SIZE)
722 CFLAGS += -Os 728 CFLAGS += -Os
723 else ifeq ($(OPTIMIZE), MAXSPEED) 729 else ifeq ($(OPTIMIZE), MAXSPEED)
724 CFLAGS += -O3 730 CFLAGS += -O3
725 CFLAGS += -fomit-frame-pointer -freg-struct-return 731 CFLAGS += -fomit-frame-pointer
732 ifeq ($(findstring clang,$(CC)),)
733 # Only GCC supports the "reg-struct-return" option. Clang doesn't support this.
734 CFLAGS += -freg-struct-return
735 endif
726 else # SPEED 736 else # SPEED
727 CFLAGS += -O2 737 CFLAGS += -O2
728 endif 738 endif
729 LFLAGS += -s 739 LFLAGS += -s
730 endif 740 endif
731 741
732 ifeq ($(COVERAGE),yes) 742 ifeq ($(COVERAGE),yes)
733 CFLAGS += --coverage 743 CFLAGS += --coverage
734 LFLAGS += --coverage 744 LFLAGS += --coverage
745 endif
746
747 # If the ASAN=yes argument is supplied, then compile Vim with the address
748 # sanitizer (asan). Only supported by MingW64 clang compiler.
749 # May make Vim twice as slow. Errors are reported on stderr.
750 # More at: https://code.google.com/p/address-sanitizer/
751 # Useful environment variable:
752 # set ASAN_OPTIONS=print_stacktrace=1 log_path=asan
753 ifeq ($(ASAN),yes)
754 #CFLAGS += -g -O0 -fsanitize-recover=all -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer
755 CFLAGS += -g -O0 -fsanitize-recover=all -fsanitize=address -fno-omit-frame-pointer
735 endif 756 endif
736 757
737 LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion 758 LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion
738 GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o 759 GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o
739 CUIOBJ = $(OUTDIR)/iscygpty.o 760 CUIOBJ = $(OUTDIR)/iscygpty.o
1074 1095
1075 ifeq (yes, $(MAP)) 1096 ifeq (yes, $(MAP))
1076 LFLAGS += -Wl,-Map=$(TARGET).map 1097 LFLAGS += -Wl,-Map=$(TARGET).map
1077 endif 1098 endif
1078 1099
1100 # The default stack size on Windows is 2 MB. With the default stack size, the
1101 # following tests fail with the clang address sanitizer:
1102 # Test_listdict_compare, Test_listdict_compare_complex, Test_deep_recursion,
1103 # Test_map_error, Test_recursive_define, Test_recursive_addstate
1104 # To increase the stack size to 16MB, uncomment the following line:
1105 #LFLAGS += -Wl,-stack -Wl,0x1000000
1106
1079 all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe uninstall.exe GvimExt/gvimext.dll 1107 all: $(MAIN_TARGET) vimrun.exe xxd/xxd.exe tee/tee.exe install.exe uninstall.exe GvimExt/gvimext.dll
1080 1108
1081 vimrun.exe: vimrun.c 1109 vimrun.exe: vimrun.c
1082 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB) 1110 $(CC) $(CFLAGS) -o vimrun.exe vimrun.c $(LIB)
1083 1111