Author: ankit
Date: 2007-12-31 11:40:40 -0500 (Mon, 31 Dec 2007)
New Revision: 92067

Modified:
   trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/ChangeLog
   
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
   
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
   
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include
Log:
* SimpleProjectMakefileHandler.cs: Use macros for emitting deploy
targets. Saves lot of redundant lines.
Honor dir structure of the source deploy file (eg. f1/f2/foo.txt should
be deployed to BUILD_DIR/f1/f2/foo.txt). Do this for install/uninstall
targets also.
* templates/Makefile.include: Add macros for emitting deploy targets.
* templates/Makefile.am.project.template: Fix positioning of include
Makefile.include to fix macros for autotools based makefiles.


Modified: trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/ChangeLog
===================================================================
--- trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/ChangeLog   
2007-12-31 16:40:33 UTC (rev 92066)
+++ trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/ChangeLog   
2007-12-31 16:40:40 UTC (rev 92067)
@@ -1,3 +1,14 @@
+2007-12-31  Ankit Jain  <[EMAIL PROTECTED]>
+
+       * SimpleProjectMakefileHandler.cs: Use macros for emitting deploy
+       targets. Saves lot of redundant lines.
+       Honor dir structure of the source deploy file (eg. f1/f2/foo.txt should
+       be deployed to BUILD_DIR/f1/f2/foo.txt). Do this for install/uninstall
+       targets also.
+       * templates/Makefile.include: Add macros for emitting deploy targets.
+       * templates/Makefile.am.project.template: Fix positioning of include
+       Makefile.include to fix macros for autotools based makefiles.
+
 2007-12-21  Miguel de Icaza <[EMAIL PROTECTED]> 
 
        

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
     2007-12-31 16:40:33 UTC (rev 92066)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/SimpleProjectMakefileHandler.cs
     2007-12-31 16:40:40 UTC (rev 92067)
@@ -363,15 +363,19 @@
                                                if 
(configSection.DeployFileVars.ContainsKey (targetDeployVar)) {
                                                        //use the dfile from 
the config section
                                                        DeployFile dfile = 
configSection.DeployFileVars [targetDeployVar];
-                                                       string targetDeployFile 
= String.Format ("$(BUILD_DIR){0}{1}",
-                                                                       
Path.DirectorySeparatorChar, Path.GetFileName (dfile.RelativeTargetPath));
                                                        string fname = 
FileService.AbsoluteToRelativePath (
                                                                        
Path.GetFullPath (project.BaseDirectory),
                                                                        
Path.GetFullPath (dfile.SourcePath));
 
                                                        conf_vars.AppendFormat 
("{0}_SOURCE={1}\n", targetDeployVar, fname);
-                                                       if 
(!commonDeployVars.ContainsKey (targetDeployVar))
-                                                               
conf_vars.AppendFormat ("{0}={1}\n", targetDeployVar, targetDeployFile);
+
+                                                       if 
(!commonDeployVars.ContainsKey (targetDeployVar)) {
+                                                               
//FOO_DLL=$(BUILD_DIR)/foo.dll
+                                                               
conf_vars.AppendFormat ("{0}=$(BUILD_DIR){1}{2}\n",
+                                                                               
targetDeployVar,
+                                                                               
Path.DirectorySeparatorChar,
+                                                                               
dfile.RelativeTargetPath);
+                                                       }
                                                } else {
                                                        // not common and not 
part of @configSection
                                                        conf_vars.AppendFormat 
("{0}=\n", pair.Key);
@@ -385,11 +389,11 @@
                                        HandleDeployFile (pair.Value, pair.Key, 
project, ctx);
 
                                        if (commonDeployVars.ContainsKey 
(pair.Key)) {
-                                               string targetDeployFile = 
String.Format ("$(BUILD_DIR){0}{1}",
-                                                       
Path.DirectorySeparatorChar, Path.GetFileName (pair.Value.RelativeTargetPath));
-
                                                //FOO_DLL=$(BUILD_DIR)/foo.dll
-                                               deployFileCopyVars.AppendFormat 
("{0} = {1}\n", pair.Key, targetDeployFile);
+                                               deployFileCopyVars.AppendFormat 
("{0} = $(BUILD_DIR){1}{2}\n",
+                                                                       
pair.Key,
+                                                                       
Path.DirectorySeparatorChar,
+                                                                       
pair.Value.RelativeTargetPath);
                                        }
                                }
 
@@ -567,12 +571,6 @@
                                fname = FileService.NormalizeRelativePath (
                                                
FileService.AbsoluteToRelativePath (project.BaseDirectory, full_fname));
                                infname = fname + ".in";
-                               if (!generateAutotools) {
-                                       templateFilesTargets.AppendFormat 
("{0}: {1} $(top_srcdir)/config.make\n", fname, infname);
-                                       templateFilesTargets.AppendFormat (
-                                               "\tsed -e 
\"s,@prefix@,$(prefix),\" -e \"s,@PACKAGE@,$(PACKAGE),\" < {1} > {0}\n",
-                                               fname, infname);
-                               }
                                extras.AppendFormat ( "\\\n\t{0} ", infname);
 
                                //dependencyDeployFile here should be filename 
relative to the project
@@ -583,12 +581,10 @@
 
                        builtFiles.Add (Path.GetFileName 
(dfile.RelativeTargetPath));
 
-                       deployFileCopyTargets.AppendFormat ("$({0}): {1}\n", 
targetDeployVar, dependencyDeployFile);
-                       deployFileCopyTargets.AppendFormat ("\tmkdir -p 
$(BUILD_DIR)\n");
-                       deployFileCopyTargets.AppendFormat ("\tcp '$<' '$@'\n");
-                       if (!generateAutotools && (dfile.FileAttributes & 
DeployFileAttributes.Executable) != 0)
-                               deployFileCopyTargets.AppendFormat ("\tchmod 
u+x '$@'\n");
-                       deployFileCopyTargets.Append ("\n");
+                       if (dfile.ContainsPathReferences)
+                               deployFileCopyTargets.AppendFormat ("$(eval 
$(call emit-deploy-wrapper,{0},{1}))\n", targetDeployVar, dependencyDeployFile);
+                       else
+                               deployFileCopyTargets.AppendFormat ("$(eval 
$(call emit-deploy-target,{0}))\n", targetDeployVar);
 
                        switch (dfile.TargetDirectoryID) {
                                case TargetDirectory.Gac:
@@ -615,13 +611,15 @@
                        }
 
                        if (!generateAutotools) {
-                               string installDir = 
ctx.DeployContext.GetDirectory (dfile.TargetDirectoryID);
+                               string installDir = Path.GetDirectoryName 
(ctx.DeployContext.GetResolvedPath (dfile.TargetDirectoryID, 
dfile.RelativeTargetPath));
                                //FIXME: temp
                                installDir = installDir.Replace ("@prefix@", 
"$(prefix)");
                                installDir = installDir.Replace ("@PACKAGE@", 
"$(PACKAGE)");
 
-                               if (!installDirs.Contains (installDir))
+                               if (!installDirs.Contains (installDir)) {
                                        installTarget.AppendFormat ("\tmkdir -p 
$(DESTDIR){0}\n", installDir);
+                                       installDirs.Add (installDir);
+                               }
 
                                installTarget.AppendFormat ("\ttest -z '$({0})' 
|| cp $({0}) $(DESTDIR){1}\n", targetDeployVar, installDir);
                                installDeps.AppendFormat (" $({0})", 
targetDeployVar);

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
      2007-12-31 16:40:33 UTC (rev 92066)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.am.project.template
      2007-12-31 16:40:40 UTC (rev 92067)
@@ -16,6 +16,8 @@
 
 DLL_REFERENCES = %%DLL_REFERENCES%%
 
+include $(top_srcdir)/Makefile.include
+
 %%COPY_DEPLOY_FILES_VARS%%
 %%COPY_DEPLOY_FILES_TARGETS%%
 
@@ -29,4 +31,3 @@
        mkdir -p $(dir $(ASSEMBLY))
        $(ASSEMBLY_COMPILER_COMMAND) $(ASSEMBLY_COMPILER_FLAGS) 
-out:$(ASSEMBLY) -target:$(COMPILE_TARGET) $(build_sources_embed) 
$(build_resources_embed) $(build_references_ref)
 
-include $(top_srcdir)/Makefile.include

Modified: 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include
===================================================================
--- 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include
  2007-12-31 16:40:33 UTC (rev 92066)
+++ 
trunk/monodevelop/main/src/addins/MonoDevelop.Autotools/templates/Makefile.include
  2007-12-31 16:40:40 UTC (rev 92067)
@@ -30,3 +30,26 @@
 bin_SCRIPTS = $(BINARIES)
 
 %%DEPLOY_DIRS%%
+
+# macros
+
+# $(call emit-deploy-target,deploy-variable-name)
+define emit-deploy-target
+$($1): $($1_SOURCE)
+       mkdir -p $$(dir $($1))
+       cp '$$<' '$$@'
+endef
+
+# $(call emit-deploy-wrapper,wrapper-variable-name,wrapper-sourcefile)
+# assumes that for a wrapper foo.pc its source template is foo.pc.in
+define emit-deploy-wrapper
+$($1): $2 $(top_srcdir)/config.make
+       mkdir -p $$(BUILD_DIR)
+       cp '$$<' '$$@'
+       chmod +x '$$@'
+
+$2: $2.in $(top_srcdir)/config.make
+       sed -e "s,@prefix@,$(prefix)," -e "s,@PACKAGE@,$(PACKAGE)," < $2.in > $2
+
+endef
+

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to