Skip to content

Commit 22b4d77

Browse files
committed
msvc: add a Makefile target to pre-generate the VS solution
The entire idea of generating the VS solution makes only sense if we generate it via Continuous Integration; otherwise potential users would still have to download the entire Git for Windows SDK. So let's just add a target in the Makefile that can be used to generate said solution; The generated files will then be committed so that they can be pushed to a branch ready to check out by Visual Studio users. To make things even more useful, we also generate and commit other files that are required to run the test suite, such as templates and bin-wrappers: with this, developers can run the test suite in a regular Git Bash (that is part of a regular Git for Windows installation) after building the solution in Visual Studio. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 0940199 commit 22b4d77

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

config.mak.uname

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,65 @@ endif
438438
X = .exe
439439

440440
compat/msvc.o: compat/msvc.c compat/mingw.c GIT-CFLAGS
441+
442+
vcxproj:
443+
# Require clean work tree
444+
git update-index -q --refresh && \
445+
git diff-files --quiet && \
446+
git diff-index --cached --quiet HEAD --
447+
448+
# Make .vcxproj files and add them
449+
unset QUIET_GEN QUIET_BUILT_IN; \
450+
perl contrib/buildsystems/generate -g Vcxproj
451+
git add -f git.sln {*,*/lib,t/helper/*}/{packages.config,*.vcxproj}
452+
453+
# Add common-cmds.h
454+
$(MAKE) MSVC=1 prefix=/mingw64 common-cmds.h
455+
git add -f common-cmds.h
456+
457+
# Add scripts
458+
rm -f perl/perl.mak
459+
$(MAKE) MSVC=1 prefix=/mingw64 \
460+
$(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
461+
# Strip out the sane tool path, needed only for building
462+
sed -i '/^git_broken_path_fix ".*/d' git-sh-setup
463+
git add -f $(SCRIPT_LIB) $(SCRIPT_SH_GEN) $(SCRIPT_PERL_GEN)
464+
465+
# Add Perl module
466+
$(MAKE) -C perl
467+
git add -f perl/blib/lib
468+
469+
# Add bin-wrappers, for testing
470+
rm -rf bin-wrappers/
471+
$(MAKE) MSVC=1 prefix=/mingw64 $(test_bindir_programs)
472+
# Ensure that the GIT_EXEC_PATH is a Unix-y one, and that the absolute
473+
# path of the repository is not hard-coded (GIT_EXEC_PATH will be set
474+
# by test-lib.sh according to the current setup)
475+
sed -i -e 's/^\(GIT_EXEC_PATH\)=.*/test -n "$${\1##*:*}" ||\
476+
\1="$$(cygpath -u "$$\1")"/' \
477+
-e "s|'$$(pwd)|\"\$$GIT_EXEC_PATH\"'|g" bin-wrappers/*
478+
# Ensure that test-* helpers find the .dll files copied to top-level
479+
sed -i 's|^PATH=.*|&:"$$GIT_EXEC_PATH"|' bin-wrappers/test-*
480+
# We do not want to force hard-linking builtins
481+
sed -i 's|\(git\)-\([-a-z]*\)\.exe"|\1.exe" \2|g' \
482+
bin-wrappers/git-{receive-pack,upload-archive}
483+
git add -f $(test_bindir_programs)
484+
# remote-ext is a builtin, but invoked as if it were external
485+
sed 's|receive-pack|remote-ext|g' \
486+
<bin-wrappers/git-receive-pack >bin-wrappers/git-remote-ext
487+
git add -f bin-wrappers/git-remote-ext
488+
489+
# Add templates
490+
$(MAKE) -C templates
491+
git add -f templates/boilerplates.made templates/blt/
492+
493+
# Add build options
494+
$(MAKE) MSVC=1 prefix=/mingw64 GIT-BUILD-OPTIONS
495+
git add -f GIT-BUILD-OPTIONS
496+
497+
# Commit the whole shebang
498+
git commit -m "Generate Visual Studio solution" \
499+
-m "Auto-generated by \`$(MAKE)$(MAKEFLAGS) $@\`"
441500
endif
442501
ifeq ($(uname_S),Interix)
443502
NO_INITGROUPS = YesPlease

0 commit comments

Comments
 (0)