What do people think? Maybe I should give a glance into nmake
source. It might be fair to include an nmakefile... or maybe
adapting it completely? Anyone else has made some experience
with nmake?
Regards,
Anselm
----- Forwarded message from Icarus Sparry <wmii_AT_XXXXXXXXXXXXk.com> -----
Date: 4 Aug 2006 05:56:31 -0000
From: Icarus Sparry <wmii_AT_XXXXXXXXXXXXk.com>
To: garbeam_AT_wmii.de
Cc: wmii_AT_XXXXXXXXXXXXk.com
Subject: Nmake
This is what nmake does, given the Nmakefile I gave you.
Firstly I get rid of everything under /tmp/dwm, and then I do a 'namke install'.
$ rm -rf /tmp/dwn/
$ nmake install
+ cmp -s config.default.h config.h
+ rm -f config.h
+ cp config.default.h config.h
+ cc -O -O3 -I. -I- -c client.c
+ cc -O -O3 -I. -I- -c draw.c
+ cc -O -O3 -I. -I- -c event.c
+ cc -O -O3 -I. -I- '-DVERSION="0.7"' -c main.c
+ cc -O -O3 -I. -I- -c tag.c
+ cc -O -O3 -I. -I- -c util.c
+ cc -O -O3 -Wl,-z,origin '-Wl,-R,$ORIGIN/../lib' -o dwm client.o draw.o event.o main.o tag.o util.o -lXext -lX11 -lnsl -ldl
+ mkdir -p /tmp/dwn/bin
+ ignore cp dwm /tmp/dwn/bin/dwm
+ mkdir -p /tmp/dwn/man/man1
+ ignore cp dwm.1 /tmp/dwn/man/man1/dwm.1
Things worth noting.
It worked out that main.o depended on the value of the VERSION variable. It converted the VERSION
variable into a define.
I still have the 'time based' rule for config.h, so it looks to see if the config.h differs from
the default, and only copies it if it does,
It is not applicable here, but it sets up the runtime search path for libraries to be the ../lib
directory relative to the place the binary is found. This makes it much simpler to ship a tar of
a program to a remote site - all they need to do is unpack the tar and type the full name of the
binary for it to be able to find its libraries.
You are correct that I don't need the '-lsocket'. nmake worked this out and didn't use it.
The 'ignore' are references to a shell function, which just ignores the return code of the function.
I listed "dwm.1" as one of the prerequsites of dwm, and it created a manual tree under /tmp/dwm, and
installed it.
It is not obvious, but everything is set up to have seperate source and object files, which makes
it easy to build for say sparc/solaris in one object tree and i686/linux in another object tree,
but keeping just one source tree.
If I recover a file, perhaps from a tar archive, so that its timestamp is older than its '.o', then
nmake will notice and remake the '.o' even though the '.o' is newer than the '.c'. This contrasts
with normal make, which is strictly timestamp driven.
If I now type 'nmake VERSION=\"test\" install' I get the following.
$ nmake VERSION=\"test\" install
+ cc -O -O3 -I. -I- '-DVERSION="test"' -c main.c
+ cc -O -O3 -Wl,-z,origin '-Wl,-R,$ORIGIN/../lib' -o dwm client.o draw.o event.o main.o tag.o util.o -lXext -lX11 -lnsl -ldl
+ mv -f /tmp/dwn/bin/dwm /tmp/dwn/bin/dwm.old
+ ignore cp dwm /tmp/dwn/bin/dwm
So you see it only recompiles main.o, with the correct value for VERSION, and then nicely moves
any running dwm out of the way and copies the new dwm into place. Nothing that could not be
done with 'make, but you don't need to write it for nmake as it is in the base rules.
Thank you for the pointer to "mk", although I was already aware of it. The nice thing about nmake
is that it does a lot of the complicated portability work for you. Clearly it is not a simple
program, but it does enable you to make simple Nmakefiles which are very portable and have a
lot of functionality in them. For example
$ nmake pax
+ pax -d -w -f dwm-0.7.pax LICENSE Makefile Nmakefile README client.c config.default.h config.mk \
draw.c dwm.1 dwm.h dwm.html dwm.png event.c main.c tag.c util.c
(Yes, I do not mention config.*.h, just config.default.h in the Nmakefile I sent you).
Icarus
----- End forwarded message -----
-- Anselm R. Garbe ><>< www.ebrag.de ><>< GPG key: 0D73F361Received on Fri Aug 04 2006 - 09:22:38 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:29:55 UTC