On 11/8/06, David Wuertele <davew motorola.com> wrote:
> I'm making a makefile library that has to stand up to
some chaotic file naming
> schemes. I need make to copy some files around, only
when necessary, without
> getting confused by filenames with spaces and special
(ie make-meaningful)
> characters.
>
> One problem I have is that make chokes on spaces and $
characters. For example,
I posted a partial solution to this problem from a previous
thread
that may get you started.
[1] http://lists.gnu.org/archive/html/help-make/200
5-08/msg00095.html
It sounds like your situation may be more complicated than
Java inner
classes. However, aside from the solutions echoed here
[2] http://lists.gnu.org/archive/cgi-bin/namazu.cgi?query=space
s+in+filenames&submit=Search&idxname=help-make
to avoid any special characters in filenames, I can offer
these tidbits.
- If you need to propogate a $ character through gmake to
the shell,
remember that both will expand it. In the post from [1],
you may
notice an instance of $$$$. I have seen it get as
ridiculous or worse
when dealing with dollar signs that need to be armored
against make
and shell processing. (eg. $$$$, etc.)
- Don't let make know about the filenames. Have make
generate
sentinel files with acceptable names and use shell
constructs to
generate the filenames. This is shown in the makefile
included below.
- Once you figure out what you need to do to get make to
deal with
your directory structure and can formalize it, it may make
sense to
autogenerate the makefiles using some kind of preprocessing
in order
to tie these difficulties up and deal with them in
isolation. (This
is its own ball of wax.)
The following is a modified version of your original
makefile which
ostensibly does what you were trying to do. It uses the
sentinels
concept I mentioned in the tidbits above. I think it
sidesteps your
issue a bit because it sounds like you have extant files
which you
would like to read into make variables and deal with using
normal make
means. That will be more difficult. Please hit the list
again if you
need more help.
Ken
---GNUmakefile---
# You may need to remove newlines placed here by gmail, it
should
# be 28 lines long.
SOURCE_DIR := source-dir
source-files =
$(SOURCE_DIR)/one
$(SOURCE_DIR)/two
$(SOURCE_DIR)/three/four
$(SOURCE_DIR)/three/5
$(SOURCE_DIR)/three/6
.PHONY: all
all: $(source-files)
.PHONY: clean
clean:
rm -rf $(SOURCE_DIR)
# make dirs
$(SOURCE_DIR): ; mkdir -p $
$(SOURCE_DIR)/three: | $(SOURCE_DIR) ; mkdir -p $
# make files
$(SOURCE_DIR)/one: | $(SOURCE_DIR) ; echo "one"
> $
$(SOURCE_DIR)/two: | $(SOURCE_DIR) ; echo "two"
> $
$(SOURCE_DIR)/three/four: | $(SOURCE_DIR)/three ; echo
"four" > $
$(SOURCE_DIR)/three/5: | $(SOURCE_DIR)/three ; echo
"five" >
$( D)/"file! with? $$special characters in:
its.name." ; touch $
$(SOURCE_DIR)/three/6: | $(SOURCE_DIR)/three ; mkdir $( D)/"directory!
with? $$special characters in: its.name." ; echo
"six" >
$( D)/"directory! with? $$special characters in:
its.name."/six ;
touch $
_______________________________________________
Help-make mailing list
Help-make gnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make
|