Re: [AD] 4.0.2 release

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hein Zelle wrote:
> 
> Eric Botcazou wrote:
> 
> > If there is really a bunch of rm statements, perhaps could you try a loop
> > construct ?
> >
> > define RM_FILES
> >    $(foreach file, $(wildcard $(CLEAN_FILES)), rm $(file)
> >    )
> > endef
> >
> > clean:
> >     $(RM_FILES)
> >
> > But that's less efficient.
> 
> I'll try if I can get something like that to work, I'll have to read
> up on the use of define and foreach in makefiles.

It should be possible to do something like (tested under DOS/Windows):

[ BEGIN MAKEFILE SNIP ]
SET_A := a e i o u
SET_B := b c d f g
SET_C := 1 2 3 4 5 6 7 8 9 0
SET_D := src/*.c src/misc/*.c
SETS  := SET_A SET_B SET_C SET_D  # Names of variables, not values!

clean:
define RM_FILES
    $(foreach pack, $(SETS), @rm -rf $(wildcard $($(pack)))
    )
endef
    -$(RM_FILES)
[ END MAKEFILE SNIP ]

The two problems is that it is almost the same as writing each rm statement by
hand, and that you must define a variable to hold all the variables holding the
files to be cleaned (in this case, SETS).

Otherwise, and as a panic solution, it might be possible to rm */*/*.o* ;)


--
Roberto Alfonso (rpgrca@xxxxxxxxxx <> rpgrca@xxxxxxxxxx)
Rhynox, the Noble Rockfriend, Wild Battlerager of the Neidar Clan and
Proficient Blacksmith, rising hero, male dwarf (Genesis is the key)
ICQ: 44361979



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/