Skip to content

Commit 6710e03

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 b7aba11 commit 6710e03

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
@@ -444,6 +444,65 @@ endif
444444
X = .exe
445445

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

0 commit comments

Comments
 (0)