help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Living with Automake - a game for us


From: Soren Andersen
Subject: Living with Automake - a game for us
Date: Sat, 31 Aug 2002 08:20:50 UT

Hello,

I just don't like having to live with automake. The Makefiles that it
generates offend me. But that's not the topic of this article.

One minor cosmetic annoyance that is charcateristic of the output of
recent versions of automake is this:
#   DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
[hash # in first col: ignore pls]

When building in the srcdir, which I sometimes do for quick projects,
this results in the gcc output to the console during build:
#   -I. -I. -I.
[hash # in first col: ignore pls]

Stustustu-tuttering GNU tools?!? Puuuleeeze.

I invented something to fix it, so that while I am spending the hours
it often requires to debug the build of some Autoconfiscated package
on Cygwin, I at least don't have to look at this cr*p.

My fix is like this:

DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
# *****************************************************************
# Remove repeating, serial duplicate (stu-stu-stu..stuttering)
# DEFAULT_INCLUDES that are generated by automake.
# *****************************************************************
boildown= $(if $(filter-out $(2),$(1)),$(2))
paired1 = $(wordlist 1,2,$(DEFAULT_INCLUDES))
paired2 = $(wordlist 2,3,$(DEFAULT_INCLUDES))
resolvd_= $(foreach n,1 2,$(call boildown,$(word
2,${paired$(n)}),$(word 1,${paired$(n)})))
DEF_INCS = $(if $(filter -I.,$(resolvd_)),$(strip $(resolvd_)),$(strip
-I. $(resolvd_)))
# *****************************************************************

COMPILE = $(strip $(CC) $(DEFS) $(DEF_INCS) \
                  $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
                  $(AM_CFLAGS) $(CFLAGS))

In order to get this into a Makefile that's been generated by
'configure', I use a Perl script that does in-place editing. Not an
optimal solution IMO but for right now that's how I can automate this.

My question is, can this be improved? Is there a way to remove
consecutive repetetive strings ("-I.") in make? Other than this one?
This one is a little ingenious, I'll admit I think so. But can a 'make'
guru like Paul Smith offer an improvement on it -- do you see what I am
trying to do? Particularly, I'd like to generalize this so that the
number of repetitions wasn't 'hard-coded' into the thing, but instead
could adapt to input of unknown number of (potential) repetitions.

  Thanks, fun, thanks!

     Soren A
 -- *perlspinr* --
-- 
The fastest email on the Internet! 
http://fastmail.fm - Choose from over 50 domains or use your own




reply via email to

[Prev in Thread] Current Thread [Next in Thread]