Skip to content

Commit 604ecb5

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 65e2e51 commit 604ecb5

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
@@ -431,6 +431,65 @@ endif
431431
X = .exe
432432

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

0 commit comments

Comments
 (0)