|
| 1 | +# |
| 2 | +# Copyright (c) Citrix Systems, Inc. |
| 3 | +# All rights reserved. |
| 4 | +# |
| 5 | +# Redistribution and use in source and binary forms, with or without |
| 6 | +# modification, are permitted provided that the following conditions |
| 7 | +# are met: |
| 8 | +# |
| 9 | +# 1) Redistributions of source code must retain the above copyright |
| 10 | +# notice, this list of conditions and the following disclaimer. |
| 11 | +# |
| 12 | +# 2) Redistributions in binary form must reproduce the above |
| 13 | +# copyright notice, this list of conditions and the following |
| 14 | +# disclaimer in the documentation and/or other materials |
| 15 | +# provided with the distribution. |
| 16 | +# |
| 17 | +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 18 | +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 19 | +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 20 | +# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 21 | +# COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 22 | +# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | +# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 25 | +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 26 | +# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 28 | +# OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 | +# |
| 30 | + |
| 31 | +USE_OCAMLFIND = true |
| 32 | + |
| 33 | +SUPPORT_CS = csharp/src/*.cs |
| 34 | + |
| 35 | +POWERSHELL_TMP=$(BINDINGS_TMP)/XenServerPSSnapIn |
| 36 | +POWERSHELL_GEN=$(BINDINGS_TMP)/powershell_autogen |
| 37 | +CSHARP_GEN=$(BINDINGS_TMP)/csharp_gen |
| 38 | +CSHARP_SRC_TMP=$(BINDINGS_TMP)/XenServer.NET-src/XenServer.NET |
| 39 | +CSHARP_BIN_TMP=$(BINDINGS_TMP)/XenServer.NET-bin/XenServer.NET |
| 40 | +CSHARP_GUI_TMP=$(BINDINGS_TMP)/XenCenterBindings/XenServer.NET |
| 41 | +CSHARP_SAM_TMP=$(BINDINGS_TMP)/XenServer.NET-sam/XenServer.NET |
| 42 | + |
| 43 | +OCAMLINCLUDES += .. $(DATAMODEL_DIR) |
| 44 | +OCAMLFLAGS += -dtypes -I $(DATAMODEL_DIR) |
| 45 | +OCAMLPACKS += getopt xmlm xml-light2 uuid stdext log unix |
| 46 | +OCAML_LIBS += $(DATAMODEL_DIR)/datamodel |
| 47 | + |
| 48 | +.PHONY: clean dist |
| 49 | +.SUBDIRS: powershell csharp c java |
| 50 | + |
| 51 | +.PHONY: csharp_samples csharp_src csharp_gui csharp_bin_readmes powershell_src |
| 52 | +csharp_gui: $(BINDINGS_TMP)/XenCenterBindings.zip |
| 53 | + |
| 54 | +dist: powershell_src csharp_samples csharp_src csharp_gui csharp_bin_readmes c_folders java_folders |
| 55 | + |
| 56 | + |
| 57 | +Flip(dir) = |
| 58 | + cd $(dir) && sh $(shell readlink -f $(ROOT))/windows-line-endings.sh |
| 59 | + |
| 60 | +ZipUp(dir, dest) = |
| 61 | + d = $(basename $(dest)) |
| 62 | + cd $(dir)/.. && zip -q -r9 $(d) $(basename $(dir)) && mv $(d) $(dest) |
| 63 | + |
| 64 | +CSharpReadme(dir, specific) = |
| 65 | + sed -e 's/@PRODUCT_VERSION@/$(PRODUCT_VERSION)/g' csharp/README-common.txt.dist >$(dir)/README.txt |
| 66 | + cat csharp/README-$(specific).txt.dist >>$(dir)/README.txt |
| 67 | + $(INSTALL) $(XMLRPCLICENSE) $(dir)/LICENSE.CookComputing.XmlRpcV2 |
| 68 | + $(INSTALL) LICENSE $(dir)/LICENSE.txt |
| 69 | + |
| 70 | +InstallAndBrand(sourcefile, targetfile) = |
| 71 | + $(INSTALL) $(sourcefile) $(targetfile) |
| 72 | + sed -i -e 's/@PRODUCT_VERSION@/$(PRODUCT_VERSION)/g' $(targetfile) |
| 73 | + |
| 74 | +csharp_src: gen_gui_csharp_bindings |
| 75 | + mkdir -p $(CSHARP_SRC_TMP)/Properties |
| 76 | + mv $(CSHARP_GEN)/XenObjectDownloader.cs $(CSHARP_GEN)/XenObjectDownloader.tmp |
| 77 | + sh csharp/subst-autogen-csproj.sh $(CSHARP_GEN) csharp/src/XenServer.csproj $(CSHARP_SRC_TMP)/XenServer.csproj |
| 78 | + $(INSTALL) $(CSHARP_GEN)/*.cs $(CSHARP_SRC_TMP) |
| 79 | + $(INSTALL) $(CSHARP_GEN)/FriendlyErrorNames.resx $(CSHARP_SRC_TMP) |
| 80 | + $(INSTALL) $(SUPPORT_CS) $(CSHARP_SRC_TMP) |
| 81 | + mv $(CSHARP_SRC_TMP)/AssemblyInfo.cs $(CSHARP_SRC_TMP)/Properties/AssemblyInfo.cs |
| 82 | + sed -i -e 's/1\.0\.0\.0/$(PRODUCT_VERSION).0/g' $(CSHARP_SRC_TMP)/Properties/AssemblyInfo.cs |
| 83 | + mv $(CSHARP_GEN)/XenObjectDownloader.tmp $(CSHARP_GEN)/XenObjectDownloader.cs |
| 84 | + CSharpReadme($(CSHARP_SRC_TMP), src) |
| 85 | + Flip($(CSHARP_SRC_TMP)) |
| 86 | + mkdir -p $(SDK_NET_FOLDER)/src && cp -r $(CSHARP_SRC_TMP)/* $(SDK_NET_FOLDER)/src |
| 87 | + cp $(CSHARP_GEN)/callVersions.csv $(MY_OUTPUT_DIR) |
| 88 | + |
| 89 | +csharp_samples: |
| 90 | + mkdir -p $(CSHARP_SAM_TMP) |
| 91 | + $(INSTALL) csharp/samples/XenSdkSample.sln $(CSHARP_SAM_TMP) |
| 92 | + foreach(example, GetVariousRecords GetVmRecords VmPowerStates) |
| 93 | + mkdir -p $(CSHARP_SAM_TMP)/$(example)/Properties |
| 94 | + $(INSTALL) csharp/samples/$(example)/Properties/AssemblyInfo.cs $(CSHARP_SAM_TMP)/$(example)/Properties |
| 95 | + $(INSTALL) csharp/samples/$(example)/$(example).csproj $(CSHARP_SAM_TMP)/$(example) |
| 96 | + $(INSTALL) csharp/samples/$(example)/Program.cs $(CSHARP_SAM_TMP)/$(example) |
| 97 | + CSharpReadme($(CSHARP_SAM_TMP), samples) |
| 98 | + Flip($(CSHARP_SAM_TMP)) |
| 99 | + mkdir -p $(SDK_NET_FOLDER)/samples && cp -r $(CSHARP_SAM_TMP)/* $(SDK_NET_FOLDER)/samples |
| 100 | + |
| 101 | +$(BINDINGS_TMP)/XenCenterBindings.zip: gen_gui_csharp_bindings |
| 102 | + mkdir -p $(CSHARP_GUI_TMP) |
| 103 | + $(INSTALL) $(CSHARP_GEN)/*.cs $(CSHARP_GUI_TMP) |
| 104 | + $(INSTALL) $(CSHARP_GEN)/FriendlyErrorNames.resx $(CSHARP_GUI_TMP) |
| 105 | + $(INSTALL) $(SUPPORT_CS) $(CSHARP_GUI_TMP) |
| 106 | + rm $(CSHARP_GUI_TMP)/AssemblyInfo.cs |
| 107 | + Flip($(CSHARP_GUI_TMP)) |
| 108 | + ZipUp($(CSHARP_GUI_TMP), $@) |
| 109 | + |
| 110 | +powershell_src: csharp_src gen_powershell_bindings powershell_samples |
| 111 | + mkdir -p $(POWERSHELL_TMP) |
| 112 | + $(INSTALL) powershell/src/*.cs $(POWERSHELL_TMP) |
| 113 | + sed -i -e 's/1\.0\.0\.0/$(PRODUCT_VERSION)/g' $(POWERSHELL_TMP)/AssemblyInfo.cs |
| 114 | + sed -i -e 's/1000/$(PRODUCT_VERSION).0/g' $(POWERSHELL_TMP)/AssemblyInfo.cs |
| 115 | + $(INSTALL) $(POWERSHELL_GEN)/* $(POWERSHELL_TMP) |
| 116 | + InstallAndBrand(powershell/README.txt.dist, $(POWERSHELL_TMP)/README.txt) |
| 117 | + InstallAndBrand(powershell/about_XenServer.help.txt, $(POWERSHELL_TMP)/about_XenServer.help.txt) |
| 118 | + $(INSTALL) LICENSE $(POWERSHELL_TMP)/LICENSE.txt |
| 119 | + $(INSTALL) $(XMLRPCLICENSE) $(POWERSHELL_TMP)/LICENSE.CookComputing.XmlRpcV2 |
| 120 | + Flip($(POWERSHELL_TMP)) |
| 121 | + mkdir -p $(SDK_PS_FOLDER)/src && cp $(POWERSHELL_TMP)/* $(SDK_PS_FOLDER)/src |
| 122 | + |
| 123 | +csharp_bin_readmes: |
| 124 | + mkdir -p $(CSHARP_BIN_TMP) |
| 125 | + CSharpReadme($(CSHARP_BIN_TMP), bin) |
| 126 | + Flip($(CSHARP_BIN_TMP)) |
| 127 | + |
| 128 | +clean: |
| 129 | + rm -f *.annot *.o *.cmi *.cmx *.cmo *.cma *.cmxa *.run *.opt *.omc *.dll |
| 130 | + rm -Rf $(BINDINGS_TMP) |
0 commit comments