On 02.09 Rasmus Tamstorf wrote:
> On Fri, 9 Feb 2001, Kelm, Peter TBG wrote:
>
>
> That's fine with me. I'm not religious about any particular extension as
> long as it works for all compilers, so that still leaves .cxx, .cpp and
> .cc.
>
cpp sounds to much to win-dos, forcing 3 char extensions...
Better use .cc, just two fast keystrokes on 'c', not looking for '+'.
And a point that is not looket at, is that it not only depends on the
compiler that can admit the extension, but also on the make system that
recognizes the extension as a valid one. If not, you have to include
all the time the .SUFFIXES lines in your makefiles.
>From the info in make 3.79.1 (Catalog of Implicit Rules):
Compiling C programs
`N.o' is made automatically from `N.c' with a command of the form
`$(CC) -c $(CPPFLAGS) $(CFLAGS)'.
Compiling C++ programs
`N.o' is made automatically from `N.cc' or `N.C' with a command of
the form `$(CXX) -c $(CPPFLAGS) $(CXXFLAGS)'. We encourage you to
use the suffix `.cc' for C++ source files instead of `.C'.
So GNU make votes for .cc, and that is the way to make life easy. If
any other thing is used, that only contributes to have to include more
extra things in the build tree that could work just with the defaults.
Same problem occurs with portability. My thesis code has to be built in
win and unix. Usually, going for make into subdirs was a pain, because
for syntax
is different in DOS and bash/ksh/sh, and writing the code inside the loop
with cd, backslashes, and so on. The I discovered the marvelous
'foreach' built-in for in gnumake, so you can do
$(foreach dir,$(SUBDIRS),$(MAKE) -C $(dir))
and loops are portable between win and unix.
So my advice is: read first the full manual of GNU make, don't do like me.
--
J.A. Magallon $> cd pub
mailto:jamagallon@xxxxxxx $> more beer
Linux werewolf 2.4.1-ac8 #2 SMP Fri Feb 9 01:53:46 CET 2001 i686
|