[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to maintain program version info with Make?
From: |
Paul D. Smith |
Subject: |
Re: How to maintain program version info with Make? |
Date: |
16 Jul 2004 14:45:40 -0400 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 |
%% "Bob Stark" <bstark@nospam.protechpts.com> writes:
bs> I'd like to automate this step, and keep a file in my directory
bs> with the current version number, either in the contents of the
bs> file, or in the filename. I need a few operations on this file,
bs> something like:
bs> make showversion # Show current version number and date
bs> make setversion # Set new version number into tracking file
bs> make setfiledate # Set filedate of all files to midnight on version
date
bs> make setfooters # Store the version and filedate in document footers
bs> These are just proposed externals, I'll come up with better names
bs> as it shakes out.
Sounds not too hard...
bs> What is a good practice for doing this on a win32 platform?
Aha! Now comes the fly in the ointment!
The reality is quite simple: make (even GNU make) does not provide any
built-in facilities for manipulating files in any way. All commands
make invokes are passed to a shell, and the shell does all the work.
Therefore, you will have to use some non-make tool to perform this
manipulation. There's simply no way around this.
If you elect to continue with this model I suggest you install Perl.
Although larger, it's fully supported natively on Windows with a Windows
installer (try, for example, ActiveState Perl) and it will provide you
with a single extremely powerful tool that will handle all your
requirements, rather than trying to install 20 smaller tools that would
normally be provided by a UNIX system.
An alternative would be to put the version into the makefile, as a
variable setting, then maybe you can provide it on the command line of
various already-existing tools to set the version...?
--
-------------------------------------------------------------------------------
Paul D. Smith <psmith@gnu.org> Find some GNU make tips at:
http://www.gnu.org http://make.paulandlesley.org
"Please remain calm...I may be mad, but I am a professional." --Mad Scientist