Hi Monks,
I have a somehow "inverted" Perl problem here.
I have a lot of small applications I wrote over the time that depend on a bunch of common source files (tools). This is stuff where I never bothered to "autoconf" anything and which is expected to run on both win32 and Unix/Linux (for win32, there will be VC6/VC2005 config stuff in the appropriate dirs).
When using an Unix/Linux Makefile template (since aeons), I throwed in at some point a line that determines the applications name which is going to get built. E.g.: If I have an Unix app to build in "../sources/applications/worlddomination":
sources | +---applications | | | +---loveandpeace | | | | | +---unix | | | | | +---win32 | | | +---worlddomination | | | +---unix | | | +---win32 | +---tools--- ...
there will be a (generic) Makefile in the "./worlddomination/unix" directory that emits a:
.SUFFIXES: .cxx .cpp .c .o # APPNAME is the parent directory of the current one APPNAME = ${shell perl -MCwd -e 'print +(split/\//,cwd)[-2]'} EXE = ${APPNAME} ... (the usual stuff follows) ...
and makes an application "worlddomination" (does in most cases work). I'm not a makefile guru and therefore my question: How can this be done *simpler* with one or two shell commands (I feel the Perl invocation of ${shell perl -MCwd -e 'print +(split/\//,cwd)[-2]'} is somehow a big hammer for this purpose).
Regards & Thanks
mwa
In reply to Getting rid of Perl in Makefiles by mwah
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |