GNU makefile's include directive
6 отговора
0 прегледа
GNU makefile's include directive
Здравейте,
как се подава параметър с празни пространства на include директивата?
Ето примерен скрипт:
include d:\projects\my bad named folder\test.mk
Това изкарва следната грешка:
../config/Config.mk:1: d:\projects\my: No such file or directory
../config/Config.mk:1: bad: No such file or directory
../config/Config.mk:1: named: No such file or directory
../config/Config.mk:1: folder\test.mk: No such file or directory
make: *** No rule to make target `folder\test.mk'. Stop.
Кавичките не помогноха. Google също.
как се подава параметър с празни пространства на include директивата?
Ето примерен скрипт:
include d:\projects\my bad named folder\test.mk
Това изкарва следната грешка:
../config/Config.mk:1: d:\projects\my: No such file or directory
../config/Config.mk:1: bad: No such file or directory
../config/Config.mk:1: named: No such file or directory
../config/Config.mk:1: folder\test.mk: No such file or directory
make: *** No rule to make target `folder\test.mk'. Stop.
Кавичките не помогноха. Google също.
Re: GNU makefile's include directive
Прожвай това:
Linux Command Line – Dealing with spaces in filenames
A friend asked me today how to say cd into a directory that has a space in its name… (a newbie)… If anyone else has wondered the same, the answer is to use the backslash just before the space… so to enter a directory called “This Dir” you would enter at the prompt:
# cd This\ Dir
This works for files as well (i.e. # cat This\ File.txt) For long filenames or dirs, try using tab complete (start typing the name then hit tab and it will fill in the rest of the filename for you).
Дано съм бил полезен
Linux Command Line – Dealing with spaces in filenames
A friend asked me today how to say cd into a directory that has a space in its name… (a newbie)… If anyone else has wondered the same, the answer is to use the backslash just before the space… so to enter a directory called “This Dir” you would enter at the prompt:
# cd This\ Dir
This works for files as well (i.e. # cat This\ File.txt) For long filenames or dirs, try using tab complete (start typing the name then hit tab and it will fill in the rest of the filename for you).
Дано съм бил полезен
Допълнение към въпроса
Напредък има. А в този пример липсва идеята, че пътят който се подава на директивата се генерира чрез променливи:
include $(ROOTDIR)/config/$(basename $(strip $(PROFILE))).mk
Където
PROFILE е име,
a ROOTDIR е $(realpath $(dir $(filter %/Config.mk, $(MAKEFILE_LIST)))..)
include $(ROOTDIR)/config/$(basename $(strip $(PROFILE))).mk
Където
PROFILE е име,
a ROOTDIR е $(realpath $(dir $(filter %/Config.mk, $(MAKEFILE_LIST)))..)
Re: Допълнение към въпроса
когато някой ти е помогнал е редно да благодариш, не мислиш ли ?!?!?! 
Off-topic
Ако помага с нещо - благодаря!
Няма такова намерение - да се дразни някой.

Няма такова намерение - да се дразни някой.
Re: GNU makefile's include directive
Пробвай също така да смениш наклонените чертички. Маке-то не се кефи много много на виндовските слешове.
Намери се решение
Проблема беше следният:
ROOTDIR := $(realpath $(dir $(filter %/Config.mk, $(MAKEFILE_LIST)))..)
include $(ROOTDIR)/config/Chip.mk
Което при път съдържащ празни пространства се разбива на отделни части.
След предложените идеи и самостоятално копане, се стигна до следното решение:
TMPROOTDIR := $(realpath $(dir $(filter %/Config.mk, $(MAKEFILE_LIST)))..)
null :=
space := $(null) # end of the line
ROOTDIR:= $(subst $(space),\$(space),$(TMPROOTDIR))
include $(ROOTDIR)/config/Chip.mk
Което значи да се закачи по една черта пред всяко празно пространство.
That's all folks!
ROOTDIR := $(realpath $(dir $(filter %/Config.mk, $(MAKEFILE_LIST)))..)
include $(ROOTDIR)/config/Chip.mk
Което при път съдържащ празни пространства се разбива на отделни части.
След предложените идеи и самостоятално копане, се стигна до следното решение:
TMPROOTDIR := $(realpath $(dir $(filter %/Config.mk, $(MAKEFILE_LIST)))..)
null :=
space := $(null) # end of the line
ROOTDIR:= $(subst $(space),\$(space),$(TMPROOTDIR))
include $(ROOTDIR)/config/Chip.mk
Което значи да се закачи по една черта пред всяко празно пространство.
That's all folks!