Skip to content

Commit b35c300

Browse files
authored
Merge pull request #3128 from hirooih/build-gen-vcsproj
build-sys: generate win32/ctags_vs2013.vcxproj* from source.mak
2 parents 9f18bdc + 7c4df9d commit b35c300

File tree

10 files changed

+544
-198
lines changed

10 files changed

+544
-198
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,8 @@ trim_trailing_whitespace = true
3838
[win32/*]
3939
end_of_line = crlf
4040

41+
[win32/*.vcxproj*.in]
42+
end_of_line = lf
43+
4144
[win32/*.vcxproj*]
4245
insert_final_newline = false

Makefile.am

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ EXTRA_DIST = README.md autogen.sh \
3232
win32/ctags.rc win32/ctags.exe.manifest win32/resource.h \
3333
win32/ctags_vs2013.sln \
3434
win32/ctags_vs2013.vcxproj win32/ctags_vs2013.vcxproj.filters \
35+
win32/ctags_vs2013.vcxproj.in win32/ctags_vs2013.vcxproj.filters.in \
36+
win32/Makefile \
3537
win32/gen-repoinfo.bat \
3638
misc/txt2cstr \
3739
$(PEG_INPUT) $(OPTLIB2C_INPUT) $(TXT2CSTR_INPUT) \

docs/contributions.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,10 @@ To add your parser file, ``foo.c``, into ``ctags`` do the following steps;
279279
* add ``"..\parsers\foo.c"`` in ``win32/ctags_vs2013.vcxproj``
280280
* add ``"..\parsers\foo.c"`` in ``win32/ctags_vs2013.vcxproj.filters``
281281

282-
Without updating win32 files our CI process run on Appveyor will fail.
282+
If you have GNU make, ``make -C win32`` updates the win32 files described above
283+
from ``makefile.mak``.
284+
Without updating win32 files our CI process run on
285+
Appveyor will fail.
283286

284287
See `this pull request <https://github.com/universal-ctags/ctags/pull/2765>`_
285288
for the `Meson` parser as an example of optlib parser.

makefiles/testing.mak

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,16 @@ if HAVE_RST2MAN
338338
echo "Files under docs/man are up to date." ; \
339339
fi
340340
endif
341+
# win32/ctags_vs2013.vcxproj* : committed for win32 build without POSIX tools
342+
# regenerate files w/o out-of-source build and w/ GNU make
343+
$(chkgen_verbose)if test "$(top_srcdir)" = "$(top_builddir)" \
344+
&& ($(MAKE) --version) 2>/dev/null | grep -q GNU ; then \
345+
$(MAKE) -BC win32 ; \
346+
fi
347+
$(chkgen_verbose)if ! git diff --exit-code -- win32; then \
348+
echo "Files under win32/ are not up to date." ; \
349+
echo "Please execute 'make -BC win32' and commit them." ; \
350+
exit 1 ; \
351+
else \
352+
echo "Files under win32 are up to date." ; \
353+
fi

misc/src-check

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,12 @@ check_vStringCatS_usage()
9292

9393
check_eof_chars_in_vcxproj()
9494
{
95-
local r=2
95+
local r=4
9696
local f
9797

9898
# *.vcxproj* should not have the last CRLF.
99-
for f in win32/ctags_vs2013.vcxproj win32/ctags_vs2013.vcxproj.filters; do
99+
for f in win32/ctags_vs2013.vcxproj.in win32/ctags_vs2013.vcxproj.filters.in \
100+
win32/ctags_vs2013.vcxproj win32/ctags_vs2013.vcxproj.filters; do
100101
header "Check the EOF characters of $f"
101102
local s=$(od -t c -j $(expr $(stat -c %s $f) - 1) $f)
102103
if echo "$s" | grep -q '>$'; then

win32/Makefile

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#
2+
# Copyright (c) 2021, Hiroo Hayashi
3+
#
4+
# This source code is released for free distribution under the terms of the
5+
# GNU General Public License version 2 or (at your option) any later version.
6+
#
7+
# Makefile to generate ctags_vs2013.vcxproj and ctags_vs2013.vcxproj.filters
8+
#
9+
# usage: make [-B]
10+
#
11+
# Restrictions:
12+
# - Input Files: ctags_vs2013.vcxproj.in and ctags_vs2013.vcxproj.filters.in
13+
# - The last charactor of the files must be '>'.
14+
# cf. check_eof_chars_in_vcxproj() in misc/src-check.
15+
# - Other lines must be end with LF.
16+
# - GNU make is required.
17+
18+
VCXPROJ = ctags_vs2013.vcxproj
19+
VCXPROJ_FILTERS = ctags_vs2013.vcxproj.filters
20+
SOURCE_MAK = ../source.mak
21+
22+
all: $(VCXPROJ) $(VCXPROJ_FILTERS)
23+
24+
include $(SOURCE_MAK)
25+
26+
# exclude some files for Win32 and replace a slash (/) to a backslash (\)
27+
MVC_SRCS = $(MVC_GNULIB_SRCS) $(CMDLINE_SRCS) $(LIB_SRCS) $(OPTLIB2C_SRCS) $(PARSER_SRCS) $(OPTSCRIPT_DSL_SRCS) $(DEBUG_SRCS) $(WIN32_SRCS)
28+
MVC_SRCS_EXCLUDE = main/mbcs.c main/seccomp.c main/trace.c
29+
MVC_SRCS_CONV = $(sort $(subst /,\\,$(filter-out $(MVC_SRCS_EXCLUDE),$(MVC_SRCS))))
30+
31+
MVC_HEADS = $(MVC_GNULIB_HEADS) $(CMDLINE_HEADS) $(LIB_HEADS) $(OPTLIB2C_HEADS) $(PARSER_HEADS) $(OPTSCRIPT_DSL_HEADS) $(DEBUG_HEADS) $(WIN32_HEADS)
32+
MVC_HEADS_EXCLUDE = main/interactive_p.h main/mbcs.h main/mbcs_p.h main/trace.h
33+
MVC_HEADS_CONV = $(sort $(subst /,\\,$(filter-out $(MVC_HEADS_EXCLUDE),$(MVC_HEADS))))
34+
35+
MVC_INC_DIRS1 = ..;../main;../gnulib;../parsers;../parsers/cxx;../dsl;
36+
MVC_INC_DIRS2 = ..;../main;../gnulib;../parsers;../parsers/cxx;
37+
38+
# a portable 'echo' which disables the interpretation of escape characters like 'echo -E' on bash
39+
# see https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.70/autoconf.html#Limitations-of-Builtins
40+
ECHO = printf '%s\n'
41+
# escape backslashes and newlines in the replacement pattern for sed
42+
ESCAPE_BACKSLASH = sed -e 's|\\|\\\\|g' -e 's/$$/\\/' | sed -e '$$s/\\$$//'
43+
# insert CR before LF except for the last line
44+
LF2CRLF = sed -e '$$!s/$$/\r/'
45+
46+
$(VCXPROJ): $(VCXPROJ).in $(SOURCE_MAK)
47+
@echo generating $@ ...
48+
@# C source files \
49+
SRCS=$$(for i in $(MVC_SRCS_CONV); do \
50+
$(ECHO) " <ClCompile Include=\"..\\$$i\" />"; \
51+
done); \
52+
SRCS=$$($(ECHO) "$$SRCS" | $(ESCAPE_BACKSLASH)); \
53+
# header files \
54+
HEADS=$$(for i in $(MVC_HEADS_CONV); do \
55+
$(ECHO) " <ClInclude Include=\"..\\$$i\" />"; \
56+
done; \
57+
$(ECHO) " <ClInclude Include=\"resource.h\" />"); \
58+
HEADS=$$($(ECHO) "$$HEADS" | $(ESCAPE_BACKSLASH)); \
59+
# replace @foo@ in $(VCXPROJ).in \
60+
sed -e "s![@]SRCS[@]!$$SRCS!" \
61+
-e "s![@]HEADS[@]!$$HEADS!" \
62+
-e "s|[@]INC_DIRS1[@]|${MVC_INC_DIRS1}|" \
63+
-e "s|[@]INC_DIRS2[@]|${MVC_INC_DIRS2}|" $< | $(LF2CRLF) > $@
64+
65+
$(VCXPROJ_FILTERS): $(VCXPROJ_FILTERS).in $(SOURCE_MAK)
66+
@echo generating $@ ...
67+
@# C source files \
68+
SRCS=$$(for i in $(MVC_SRCS_CONV); do \
69+
dirname=$$($(ECHO) $$i | sed -e 's/\\[a-zA-Z_0-9.-]*$$//'); \
70+
$(ECHO) " <ClCompile Include=\"..\\$$i\">"; \
71+
$(ECHO) " <Filter>Source Files\\$$dirname</Filter>"; \
72+
$(ECHO) " </ClCompile>"; \
73+
done); \
74+
SRCS=$$($(ECHO) "$$SRCS" | $(ESCAPE_BACKSLASH)); \
75+
# header files \
76+
HEADS=$$(for i in $(MVC_HEADS_CONV); do \
77+
$(ECHO) " <ClInclude Include=\"..\\$$i\">"; \
78+
$(ECHO) " <Filter>Header Files</Filter>"; \
79+
$(ECHO) " </ClInclude>"; \
80+
done; \
81+
$(ECHO) " <ClInclude Include=\"resource.h\">"; \
82+
$(ECHO) " <Filter>Header Files</Filter>"; \
83+
$(ECHO) " </ClInclude>"); \
84+
HEADS=$$($(ECHO) "$$HEADS" | $(ESCAPE_BACKSLASH)); \
85+
# replace @foo@ in $(VCXPROJ_FILTERS).in \
86+
sed -e "s![@]SRCS[@]!$$SRCS!" \
87+
-e "s![@]HEADS[@]!$$HEADS!" $< | $(LF2CRLF) > $@

win32/ctags_vs2013.vcxproj

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<ItemGroup Label="ProjectConfigurations">
44
<ProjectConfiguration Include="Debug|Win32">
@@ -172,22 +172,19 @@
172172
</Link>
173173
</ItemDefinitionGroup>
174174
<ItemGroup>
175+
<ClCompile Include="..\dsl\es.c" />
176+
<ClCompile Include="..\dsl\optscript.c" />
175177
<ClCompile Include="..\gnulib\fnmatch.c" />
176-
<ClCompile Include="..\gnulib\regex.c">
177-
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">TurnOffAllWarnings</WarningLevel>
178-
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">TurnOffAllWarnings</WarningLevel>
179-
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">TurnOffAllWarnings</WarningLevel>
180-
<WarningLevel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">TurnOffAllWarnings</WarningLevel>
181-
</ClCompile>
178+
<ClCompile Include="..\gnulib\malloc\dynarray_resize.c" />
182179
<ClCompile Include="..\gnulib\mempcpy.c" />
183180
<ClCompile Include="..\gnulib\nl_langinfo.c" />
181+
<ClCompile Include="..\gnulib\regex.c" />
184182
<ClCompile Include="..\gnulib\setlocale_null.c" />
185-
<ClCompile Include="..\gnulib\malloc\dynarray_resize.c" />
186183
<ClCompile Include="..\gnulib\wmempcpy.c" />
184+
<ClCompile Include="..\main\CommonPrelude.c" />
187185
<ClCompile Include="..\main\args.c" />
188186
<ClCompile Include="..\main\cmd.c" />
189187
<ClCompile Include="..\main\colprint.c" />
190-
<ClCompile Include="..\main\CommonPrelude.c" />
191188
<ClCompile Include="..\main\debug.c" />
192189
<ClCompile Include="..\main\dependency.c" />
193190
<ClCompile Include="..\main\entry.c" />
@@ -238,8 +235,8 @@
238235
<ClCompile Include="..\optlib\elixir.c" />
239236
<ClCompile Include="..\optlib\elm.c" />
240237
<ClCompile Include="..\optlib\gdbinit.c" />
241-
<ClCompile Include="..\optlib\inko.c" />
242238
<ClCompile Include="..\optlib\iPythonCell.c" />
239+
<ClCompile Include="..\optlib\inko.c" />
243240
<ClCompile Include="..\optlib\kconfig.c" />
244241
<ClCompile Include="..\optlib\man.c" />
245242
<ClCompile Include="..\optlib\markdown.c" />
@@ -322,9 +319,9 @@
322319
<ClCompile Include="..\parsers\objc.c" />
323320
<ClCompile Include="..\parsers\ocaml.c" />
324321
<ClCompile Include="..\parsers\pascal.c" />
325-
<ClCompile Include="..\parsers\perl.c" />
326322
<ClCompile Include="..\parsers\perl-function-parameters.c" />
327323
<ClCompile Include="..\parsers\perl-moose.c" />
324+
<ClCompile Include="..\parsers\perl.c" />
328325
<ClCompile Include="..\parsers\perl6.c" />
329326
<ClCompile Include="..\parsers\php.c" />
330327
<ClCompile Include="..\parsers\powershell.c" />
@@ -348,8 +345,8 @@
348345
<ClCompile Include="..\parsers\systemdunit.c" />
349346
<ClCompile Include="..\parsers\tcl.c" />
350347
<ClCompile Include="..\parsers\tcloo.c" />
351-
<ClCompile Include="..\parsers\tex.c" />
352348
<ClCompile Include="..\parsers\tex-beamer.c" />
349+
<ClCompile Include="..\parsers\tex.c" />
353350
<ClCompile Include="..\parsers\ttcn.c" />
354351
<ClCompile Include="..\parsers\txt2tags.c" />
355352
<ClCompile Include="..\parsers\typescript.c" />
@@ -359,11 +356,11 @@
359356
<ClCompile Include="..\parsers\windres.c" />
360357
<ClCompile Include="..\parsers\yacc.c" />
361358
<ClCompile Include="..\parsers\yumrepo.c" />
362-
<ClCompile Include="..\dsl\es.c" />
363-
<clCompile Include="..\dsl\optscript.c" />
364-
<ClCompile Include="mkstemp\mkstemp.c" />
359+
<ClCompile Include="..\win32\mkstemp\mkstemp.c" />
365360
</ItemGroup>
366361
<ItemGroup>
362+
<ClInclude Include="..\dsl\es.h" />
363+
<ClInclude Include="..\dsl\optscript.h" />
367364
<ClInclude Include="..\gnulib\fnmatch.h" />
368365
<ClInclude Include="..\gnulib\regex.h" />
369366
<ClInclude Include="..\main\args_p.h" />
@@ -415,10 +412,10 @@
415412
<ClInclude Include="..\main\read_p.h" />
416413
<ClInclude Include="..\main\routines.h" />
417414
<ClInclude Include="..\main\routines_p.h" />
418-
<ClInclude Include="..\main\script.h" />
415+
<ClInclude Include="..\main\script_p.h" />
419416
<ClInclude Include="..\main\selectors.h" />
420417
<ClInclude Include="..\main\sort_p.h" />
421-
<ClInclude Include="..\main\stat_p.h" />
418+
<ClInclude Include="..\main\stats_p.h" />
422419
<ClInclude Include="..\main\strlist.h" />
423420
<ClInclude Include="..\main\subparser.h" />
424421
<ClInclude Include="..\main\subparser_p.h" />
@@ -447,10 +444,9 @@
447444
<ClInclude Include="..\parsers\m4.h" />
448445
<ClInclude Include="..\parsers\make.h" />
449446
<ClInclude Include="..\parsers\perl.h" />
447+
<ClInclude Include="..\parsers\r.h" />
450448
<ClInclude Include="..\parsers\tcl.h" />
451449
<ClInclude Include="..\parsers\tex.h" />
452-
<ClInclude Include="..\dsl\es.h" />
453-
<ClInclude Include="..\dsl\optscript.h" />
454450
<ClInclude Include="resource.h" />
455451
</ItemGroup>
456452
<ItemGroup>

0 commit comments

Comments
 (0)