эквивалентная команда для gnumake (для ... do, если существует, del) - PullRequest
0 голосов
/ 29 февраля 2012

Я конвертирую make-файл, чтобы его можно было использовать с GNU Make.В другой программе make (не могу найти версию) ... эта часть была выполнена:

#******************************************************************************
#                                Explicit Rules
#******************************************************************************
#
# This section contents the explicit rules to create the Virtual File system.
# This file system actualy contains the files used by the Web interface.
# 
#******************************************************************************
CFGFILE = $(WEBDST)/vfs.cfg

# Compiling vfsdata
$(OBJDIR)vfsdata.o : vfsdata.c
    @echo .
    @echo ::.   COMPILING1 : vfsdata.c
    @echo ::::.
    $(NOECHOC)$(CC) $(CFLAGS) $(DEBUGFLASG) $(subst \,/,$(VFSDIR))/vfsdata.c -o"$@"     $(INCLUDE)


# Dependance of vfsdata.c
vfsdata.c : $(addprefix $(WEBSRC)\,$(WEBGLOBAL)) $(addprefix $(WEBDST)\,$(WEBLOCAL))

# Make vfsdata.c writable
    @if exist $(VFSDIR)\vfsdata.c \
            chmod 777 $(VFSDIR)\vfsdata.c

#
# Generate the configuration file needed by vfscomp
#
    @echo [general] > $(CFGFILE)
    @echo vfs_root_dir  = $(WEBDST)>> $(CFGFILE)
    @echo vfs_data_file = $(VFSDIR)\vfsdata>> $(CFGFILE)
    @echo vfs_image_var = vfsimage>> $(CFGFILE)
    @echo far_pointer   = yes>> $(CFGFILE)
    @echo compress      = yes>> $(CFGFILE)

    @echo [file] >> $(CFGFILE)
    @echo $(sort $(WEBGLOBAL) $(WEBLOCAL)) | $(TR) -s " " "[\n*]" \
                                       | $(SED) "s/gif/gif -u/g" \
                                       >> $(CFGFILE)

#
# Create the local directory tree
#
    @for %%f in ($(subst /,\,$(dir $(WEBGLOBAL)))) do \
            if not exist $(WEBDST)\%%f mkdir $(WEBDST)\%%f

#
# Copy the WEB pages directory tree localy
#
    @for %%f in ($(subst /,\,$(WEBGLOBAL))) do \
            cp -rf $(WEBSRC)\%%f $(WEBDST)\%%f

#
# Generate the virtual file system
#
    @$(TOOLDIR)/vfscomp $(subst \,/,$(CFGFILE))

#
# Delete the local directory tree
#

#delete the directory recursively exept the one in the exclusion list

    @for %%f in ($(filter-out $(EXCLUSION), $(WEBDIR))) do \
            if exist $(WEBDST)\%%f \
                    rm -rf $(WEBDST)\%%f

#delete the remaining files.

    @for %%f in ($(subst /,\,$(WEBGLOBAL))) do \
            if exist $(WEBDST)\%%f \
                    rm -f $(WEBDST)\%%f

    @del $(subst /,\,$(CFGFILE))

Когда я строю свой код, я получаю эту ошибку

The syntax of the command is incorrect.

У меня такое ощущение, что некоторые команды, такие как @for @del @if, существуют, это команды, которые не поддерживаются (или с другим синтаксисом) в make gnu.

Я проверил в онлайн документации по GNU make, но яне найдены команды, похожие на те, которые используются ниже.

Есть ли в gnu make какой-либо эквивалент команды, используемой в этой части make-файла?

Заранее спасибо!

РЕДАКТИРОВАТЬ:

Я удалил@ и выполненная марка.Я вижу, когда появляется сообщение «Синтаксис команды неверен»:

if exist ../Pa/Filesys\vfsdata.c \
    chmod 777 ../Pa/Filesys\vfsdata.c
echo [general] > ../Pa/Filesys/vfs.cfg
echo vfs_root_dir  = ../Pa/Filesys>> ../Pa/Filesys/vfs.cfg
echo vfs_data_file = ../Pa/Filesys\vfsdata>> ../Pa/Filesys/vfs.cfg
echo vfs_image_var = vfsimage>> ../Pa/Filesys/vfs.cfg
echo far_pointer   = yes>> ../Pa/Filesys/vfs.cfg
echo compress      = yes>> ../Pa/Filesys/vfs.cfg
echo [file] >> ../Pa/Filesys/vfs.cfg
echo behavior/datasync/datasync.htc behavior/defered/defered.htc behavior/inputs/indirect.htc behavior/inputs/inputs.htc behavior/progress/progress.htc behavior/slider/slBottom.gif behavior/slider/slLeft.gif behavior/slider/slRight.gif behavior/slider/slTop.gif behavior/slider/slider.htc css/env.css html/cfgmain.html html/changepass.html html/diagpa.html html/firmhlp.html html/firmware.html html/home.html html/logpage.html html/progressend.html html/progressstart.html html/soundhlp.html html/support.html html/uplmain.html html/uploadstart.html img/button.gif img/logo.gif index.html xslt/activate.xslt xslt/main.xslt xslt/netmenu.xslt xslt/page.xslt xslt/page_func.xslt xslt/progress.xslt xslt/tlmenu.xslt xslt/upload.xslt | tr -s " " "[\n*]" \
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
The syntax of the command is incorrect.
                                       | sed "s/gif/gif -u/g" \
                                       >> ../Pa/Filesys/vfs.cfg
for %%f in (.\ css\ img\ img\ xslt\ xslt\ xslt\ xslt\ xslt\ xslt\ xslt\ xslt\ html\ html\ html\ html\ html\ html\ html\ html\ html\ html\ html\ html\ behavior\slider\ behavior\slider\ behavior\slider\ behavior\slider\ behavior\slider\ behavior\datasync\ behavior\progress\ behavior\inputs\ behavior\inputs\ behavior\defered\) do \

Похоже, что синтаксическая ошибка находится где-то в строке

echo $(sort $(WEBGLOBAL) $(WEBLOCAL)) | $(TR) -s " " "[\n*]" \
                                       | $(SED) "s/gif/gif -u/g" \

Ответы [ 2 ]

2 голосов
/ 29 февраля 2012

Для ясности, ни одна из упомянутых вами команд не является командами make.Все они являются командами оболочки.Make вызывает оболочку и передает эти команды оболочке.Как уже упоминалось, "@" - это специальная команда для make (поддерживаемая всеми реализациями make на основе POSIX, включая GNU make), которая говорит make не печатать команду перед отправкой в ​​оболочку ("@" удаляется командой makeперед отправкой команды в оболочку).

Во-вторых, сообщение об ошибке «синтаксис команды неверен» - это не то, что GNU выводит.Либо вы перефразировали сообщение об ошибке, а не повторяли его дословно (никогда не бывает хорошей идеей при обращении за помощью), либо это сообщение печатается не командой make, а какой-то командой оболочки, которая вызывает вызов.

0 голосов
/ 29 февраля 2012

Это займет несколько итераций (тем более, что вы не предоставили нам полный образец).

Здесь есть два правила; попробуй их отдельно.

Попробуйте второе правило только с первой командой:

# Make vfsdata.c writable
        @if exist $(VFSDIR)\vfsdata.c \
            chmod 777 $(VFSDIR)\vfsdata.c

Дайте нам знать результаты этих экспериментов, и мы пойдем оттуда.

EDIT:

Интересно. Я предполагаю, что либо tr не нравится ваш синтаксис, либо длина этой команды превысила какой-то предел вашей марки или ОС.

Попробуйте сделать это из командной строки:

echo behavior/datasync/datasync.htc behavior/defered/defered.htc behavior/inputs/indirect.htc behavior/inputs/inputs.htc behavior/progress/progress.htc behavior/slider/slBottom.gif behavior/slider/slLeft.gif behavior/slider/slRight.gif behavior/slider/slTop.gif behavior/slider/slider.htc css/env.css html/cfgmain.html html/changepass.html html/diagpa.html html/firmhlp.html html/firmware.html html/home.html html/logpage.html html/progressend.html html/progressstart.html html/soundhlp.html html/support.html html/uplmain.html html/uploadstart.html img/button.gif img/logo.gif index.html xslt/activate.xslt xslt/main.xslt xslt/netmenu.xslt xslt/page.xslt xslt/page_func.xslt xslt/progress.xslt xslt/tlmenu.xslt xslt/upload.xslt | tr -s " " "[\n*]" \
| sed "s/gif/gif -u/g" \
>> ../Pa/Filesys/vfs.cfg

Если это удастся, это предел длины Make; попробуйте с меньшим количеством имен файлов.
Если не получится, попробуйте пропустить последний термин:

echo blah blah blah \
| sed "s/gif/gif -u/g"

Скажите нам результаты, и мы продолжим ...

...