improved build tag update script for Windows build
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 4 Dec 2017 10:53:32 +0000 (12:53 +0200)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 4 Dec 2017 10:54:53 +0000 (12:54 +0200)
build/build.vcxproj
build/updatetag.pl

index 87065f1..907cc69 100644 (file)
@@ -84,7 +84,7 @@
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <CustomBuildStep>
       <Message>Update build tag</Message>
-      <Command>updatetag.pl $(SolutionDir)\include\netxms-build-tag.h</Command>
+      <Command>updatetag.pl netxms NETXMS $(SolutionDir)\include\netxms-build-tag.h</Command>
       <Outputs>PHONY;%(Outputs)</Outputs>
     </CustomBuildStep>
     <ClCompile>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <CustomBuildStep>
       <Message>Update build tag</Message>
-      <Command>updatetag.pl $(SolutionDir)\include\netxms-build-tag.h</Command>
+      <Command>updatetag.pl netxms NETXMS $(SolutionDir)\include\netxms-build-tag.h</Command>
       <Outputs>PHONY;%(Outputs)</Outputs>
     </CustomBuildStep>
     <ClCompile>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <CustomBuildStep>
       <Message>Update build tag</Message>
-      <Command>updatetag.pl $(SolutionDir)\include\netxms-build-tag.h</Command>
+      <Command>updatetag.pl netxms NETXMS $(SolutionDir)\include\netxms-build-tag.h</Command>
       <Outputs>PHONY;%(Outputs)</Outputs>
     </CustomBuildStep>
     <Midl>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <CustomBuildStep>
       <Message>Update build tag</Message>
-      <Command>updatetag.pl $(SolutionDir)\include\netxms-build-tag.h</Command>
+      <Command>updatetag.pl netxms NETXMS $(SolutionDir)\include\netxms-build-tag.h</Command>
       <Outputs>PHONY;%(Outputs)</Outputs>
     </CustomBuildStep>
     <Midl>
index 6a58945..4cb4e6d 100644 (file)
@@ -1,6 +1,8 @@
 #!/usr/bin/perl
 
-my $file = shift || die "Usage : updatetag.pl <file>";
+my $file_prefix = shift || "netxms";
+my $define_prefix = shift || "NETXMS";
+my $file = shift || $file_prefix . "-build-tag.h";
 
 my $tag = `git describe --always`;
 chomp $tag;
@@ -34,10 +36,10 @@ if ($update == 1)
 {
        open(OUT, ">$file") or die "Cannot open output file: $!";
        print OUT "/* BUILDTAG:$tag */\n";
-       print OUT "#ifndef _build_tag_h_\n";
-       print OUT "#define _build_tag_h_\n";
-       print OUT "#define NETXMS_BUILD_TAG _T(\"$tag\")\n";
-       print OUT "#define NETXMS_BUILD_TAG_A \"$tag\"\n";
+       print OUT "#ifndef _" . $file_prefix . "_build_tag_h_\n";
+       print OUT "#define _" . $file_prefix . "_build_tag_h_\n";
+       print OUT "#define " . $define_prefix . "_BUILD_TAG _T(\"$tag\")\n";
+       print OUT "#define " . $define_prefix . "_BUILD_TAG_A \"$tag\"\n";
        print OUT "#endif\n";
        close OUT;