docs: Tiny typo.
[platform/upstream/atk.git] / build / Makefile.msvcproj
1 # Author: Fan, Chun-wei
2 # Common Autotools file used to generate Visual Studio 2008+
3 # Projects from their templates
4
5 # This autotools file, from GLib, can be used in other projects
6 # that have Visual Studio build support, and is copied into
7 # $(srcroot)/build/.
8
9 # * Input variables:
10 #
11 #   MSVCPROJS - List of Projects that should be generated
12 #
13 # * Simple tutorial
14 #
15 # Add this to Makefile.am where your library/program is built:
16 #   include $(top_srcdir)/build/Makefile.msvcproj
17 #   MSVCPROJS = YourProject (can be multiple projects in a single srcdir)
18 #   YourProject_FILES = $(libyourlib_1_0_SOURCES)
19 #   YourProject_EXCLUDES = ... # list of sources to exclude, separated by '|', wildcards allowed; use random unsed value if none
20 #   YourProject_HEADERS_DIR = $(libyourlibincludedir)
21 #   YourProject_HEADERS_INST = $(libyourlib_1_0_HEADERS)
22 #   YourProject_HEADERS_EXCLUDES = ... # <list of headers to exclude from installation, separated by '|', wildcards allowed; use random unsed value if none>
23 #
24 #   dist-hook: \ # (or add to it if it is already there, note the vs9 items will also call the vs10 items in the process)
25 #       $(top_builddir)/build/win32/vs9/YourProject.vcproj      \
26 #       $(top_builddir)/build/win32/vs9/YourProject.headers
27
28
29 # Private functions
30
31 ## Transform the MSVC project filename (no filename extensions) to something which can reference through a variable
32 ## without automake/make complaining, eg Gtk-2.0 -> Gtk_2_0
33 _proj_name=$(subst /,_,$(subst -,_,$(subst .,_,$(1))))
34 _proj_path_raw:=$(subst $(abs_top_srcdir),,$(abs_srcdir))
35 _proj_path=$(subst /,\\,$(_proj_path_raw))
36 _proj_subdir_int=$(subst \\\\,\\,\\$(_proj_path)\\)
37 _proj_subdir=$(subst \\.\\,\\,$(_proj_subdir_int))
38
39 _proj_files_raw=$(subst /,\\,$($(_proj_name)_FILES))
40 _proj_files=$(subst $(srcdir)\\,,$(subst $(builddir)\\,,$(subst $(top_builddir)\\$(_proj_path)\\,\\,$(_proj_files_raw))))
41 _proj_filters=$($(_proj_name)_EXCLUDES)
42
43 _proj_headers_raw=$(subst /,\\,$($(_proj_name)_HEADERS_INST))
44 _proj_headers=$(subst $(srcdir)\\,,$(subst $(builddir)\\,,$(subst $(top_builddir)\\$(_proj_path)\\,\\,$(_proj_headers_raw))))
45 _proj_headers_excludes=$($(_proj_name)_HEADERS_EXCLUDES)
46
47 _headers_dest_posix=$(subst $(includedir),,$($(_proj_name)_HEADERS_DIR))
48 _headers_destdir=$(subst /,\\,$(_headers_dest_posix))
49
50 #
51 # Creates Visual Studio 2008/2010 projects from items passed in from autotools files
52 # $(1) - Base Name of the MSVC project files (outputs)
53 #
54
55 define msvcproj-builder
56
57 $(top_builddir)/build/win32/vs10/$(1).vcxproj: $(top_builddir)/build/win32/vs9/$(1).vcproj
58 $(top_builddir)/build/win32/vs10/$(1).vcxproj.filters: $(top_builddir)/build/win32/vs9/$(1).vcproj
59 $(1).sourcefiles: $(top_builddir)/build/win32/vs9/$(1).vcproj
60 $(1).vs10.sourcefiles: $(top_builddir)/build/win32/vs9/$(1).vcproj
61 $(1).vs10.sourcefiles.filters: $(top_builddir)/build/win32/vs9/$(1).vcproj
62
63 $(top_builddir)/build/win32/vs9/$(1).vcproj:
64         -$(RM) $(top_builddir)/build/win32/vs9/$(1).vcproj
65         -$(RM) $(top_builddir)/build/win32/vs10/$(1).vcxproj
66         -$(RM) $(top_builddir)/build/win32/vs10/$(1).vcxproj.filters
67
68         for F in $(_proj_files); do \
69                 case $$$$F in \
70                 $(_proj_filters)) \
71                         ;; \
72                 *.c|*.cpp|*.cc|*.cxx) \
73                         echo '   <File RelativePath="..\..\..'$(_proj_subdir)$$$$F'" />' >>$(1).sourcefiles && \
74                         echo '   <ClCompile Include="..\..\..'$(_proj_subdir)$$$$F'" />' >>$(1).vs10.sourcefiles && \
75                         echo '   <ClCompile Include="..\..\..'$(_proj_subdir)$$$$F'"><Filter>Source Files</Filter></ClCompile>' >>$(1).vs10.sourcefiles.filters \
76                         ;; \
77                 esac;   \
78         done
79
80
81         $(CPP) -P - <$(top_srcdir)/build/win32/vs9/$(1).vcprojin >$(top_builddir)/build/win32/vs9/$(1).vcproj
82         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(1).vcxprojin >$(top_builddir)/build/win32/vs10/$(1).vcxproj
83         $(CPP) -P - <$(top_srcdir)/build/win32/vs10/$(1).vcxproj.filtersin >$(top_builddir)/build/win32/vs10/$(1).vcxproj.filters
84         $(RM) $(1).sourcefiles
85         $(RM) $(1).vs10.sourcefiles
86         $(RM) $(1).vs10.sourcefiles.filters
87
88 $(top_builddir)/build/win32/vs10/$(1).vs10.headers: $(top_builddir)/build/win32/vs9/$(1).headers
89
90 $(top_builddir)/build/win32/vs9/$(1).headers:
91         -$(RM) $(top_builddir)/build/win32/vs9/$(1).headers
92         -$(RM) $(top_builddir)/build/win32/vs10/$(1).vs10.headers
93
94         for F in $(_proj_headers); do \
95                 case $$$$F in \
96                 $(_proj_headers_excludes)) \
97                         ;; \
98                 *.h|*.hpp|*.hh|*.hxx) \
99                         echo 'copy ..\..\..'$(_proj_subdir)$$$$F' $$$$(CopyDir)\include'$(_headers_destdir)'\'$$$$F'&#x0D;&#x0A;' >>$(top_builddir)/build/win32/vs9/$(1).headers && \
100                         echo 'copy ..\..\..'$(_proj_subdir)$$$$F' $$$$(CopyDir)\include'$(_headers_destdir)'\'$$$$F >>$(top_builddir)/build/win32/vs10/$(1).vs10.headers \
101                         ;; \
102                 esac;   \
103         done
104
105 endef
106
107 $(foreach proj,$(MSVCPROJS),$(eval $(call msvcproj-builder,$(proj))))