1# Centralized autotools file
2# To create the Visual C++ projects
3# from the templates
4# Author: Fan, Chun-wei
5# August 30, 2012
6
7# Required Items to call this:
8# MSVC_PROJECT: name of project
9# MSVC_PROJECT_SRCDIR: subdir of source tree where sources for this project is found
10# MSVC_PROJECT_SRCS: source files to build
11# MSVC_PROJECT_EXCLUDES: source files to exclude from MSVC_PROJECT_SRCS, use dummy if none,
12# wildcards (*) are allowed, seperated by |
13# DISTCLEANFILES: Define an empty one if not previously defined
14
15# Create the complete Visual C++ 2008/2010 project files
16
17$(top_builddir)/build/win32/vs9/$(MSVC_PROJECT).vcproj: $(top_srcdir)/build/win32/vs9/$(MSVC_PROJECT).vcprojin
18	for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \
19		case $$F in \
20			$(MSVC_PROJECT_EXCLUDES)) \
21				;; \
22			*.c) echo ' <File RelativePath="..\..\..\$(MSVC_PROJECT_SRCDIR)\'$$F'" />' \
23				;; \
24			esac; \
25		done | sort -u >$(MSVC_PROJECT).sourcefiles
26	$(CPP) -P - <$(top_srcdir)/build/win32/vs9/$(MSVC_PROJECT).vcprojin >$@
27	rm $(MSVC_PROJECT).sourcefiles
28
29$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj: $(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxprojin
30	for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \
31		case $$F in \
32			$(MSVC_PROJECT_EXCLUDES)) \
33				;; \
34			*.c) echo ' <ClCompile Include="..\..\..\$(MSVC_PROJECT_SRCDIR)\'$$F'" />' \
35				;; \
36			esac; \
37		done | sort -u >$(MSVC_PROJECT).vs10.sourcefiles
38	$(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxprojin >$@
39	rm $(MSVC_PROJECT).vs10.sourcefiles
40
41$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filters: $(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filtersin
42	for F in `echo $(MSVC_PROJECT_SRCS) | sed 's/\.\///g' | tr '/' '\\'`; do \
43		case $$F in \
44			$(MSVC_PROJECT_EXCLUDES)) \
45				;; \
46			*.c) echo ' <ClCompile Include="..\..\..\$(MSVC_PROJECT_SRCDIR)\'$$F'"><Filter>Source Files</Filter></ClCompile>' \
47				;; \
48			esac; \
49		done | sort -u >$(MSVC_PROJECT).vs10.sourcefiles.filters
50	$(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filtersin >$@
51	rm $(MSVC_PROJECT).vs10.sourcefiles.filters
52
53DISTCLEANFILES += \
54	$(top_builddir)/build/win32/vs9/$(MSVC_PROJECT).vcproj \
55	$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj \
56	$(top_builddir)/build/win32/vs10/$(MSVC_PROJECT).vcxproj.filters
57