makefile: 4: * * * falta el separador. Dejar


Este es mi makefile:

all:ll

ll:ll.c   
  gcc  -c  -Wall -Werror -02 c.c ll.c  -o  ll  $@  $<

clean :
  \rm -fr ll

Cuando intento make clean o make make, obtengo este error:

:makefile:4: *** missing separator.  Stop.

¿Cómo puedo arreglarlo?

 256
Author: Greg, 2013-06-05

8 answers

Makefile tiene una relación muy estúpida con tabs , todas las acciones de cada regla son identificadas por tabs ...... y no 4 espacios no hacen una pestaña, solo una pestaña hace una pestaña...

Para comprobar uso el comando cat -e -t -v makefile_name

Muestra la presencia de pestañas con ^I y las terminaciones de línea con ^ ambas son vitales para asegurar que las dependencias terminen correctamente y las pestañas marquen la acción de las reglas para que sean fácilmente identificables para la utilidad make.....

Ejemplo:

Kaizen ~/so_test $ cat -e -t -v  mk.t
all:ll$      ## here the $ is end of line ...                   
$
ll:ll.c   $
^Igcc  -c  -Wall -Werror -02 c.c ll.c  -o  ll  $@  $<$ 
## the ^I above means a tab was there before the action part, so this line is ok .
 $
clean :$
   \rm -fr ll$
## see here there is no ^I which means , tab is not present .... 
## in this case you need to open the file again and edit/ensure a tab 
## starts the action part

Espero que esto ayuda !!

 542
Author: nsd,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-14 11:13:38

Siempre debe escribir el comando después de una "tabulación" y no un espacio en blanco.

Esto se aplica a la línea "gcc" (línea #4) en su caso. Es necesario insertar la pestaña antes de gcc.

Sustitúyase también \rm-fr ll por "rm-fr ll". Insertar pestañas antes de este comando también

 18
Author: Denny Mathew,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-05 04:59:34

En VS Code, simplemente haga clic en "Space: 4" en la esquina derecha y cámbielo a tab al editar su Makefile.

 16
Author: alanwsx,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-07-18 15:04:59

El punto clave fue " FICHA DURA" 1. Compruebe si ha utilizado TAB en lugar de espacios en blanco 2. Revisa tu .vimrc para "set tabstop = X"

 4
Author: wlsherica,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-11-21 15:05:44

Es una pregunta bastante antigua, pero aún así me gustaría decir sobre una opción más usando el editor vi/vim para visualizar las pestañas. Si tiene vi/vim instalado, abra un Makefile (por ejemplo, vim Makefile) e ingrese :set list. Esto mostrará el número de pestañas insertadas como a continuación,

 %-linux: force$
^I@if [ "$(GCC_VERSION)" = "2.96" ] ; then \$
^I^Iecho ===== Generating build tree for legacy $@ architecture =====; \$
^I^I$(CONFIGURE) $(CWD) $@ legacy; \$
^Ielse \$
^I^Iecho ===== Generating build tree for $@ architecture =====; \$
^I^I$(CONFIGURE) $(CWD) $@; \$
^Ifi$
^Icd build-$@;make$
 4
Author: Panch,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-02-13 02:00:18

Esto se debe a que tab se reemplaza por espacios. Para desactivar esta función vaya a

Gedit->edit->preferences - > editor

Y eliminar comprobar

"reemplazar tabulador con espacio "

 1
Author: Shrinivas Patgar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-09-01 13:54:55

Si alguno de ustedes está usando un producto de Intellij, la solución para esto es la siguiente:

  1. Vaya a Preferencias > Editor > Estilo de código
  2. aquí debe seleccionar el tipo de archivo relacionado con su problema. Pero lo más probable es que necesite seleccionar Other File Types.
  3. En la pestaña abierta marque la casilla de verificación para Use tab character y tenga cuidado, Tab size y Indent los valores deben ser 4.
 1
Author: Bogdan Alexandru Militaru,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-06-25 08:47:07

Si está usando mcedit para makefile edit. tienes que ver la siguiente marca. introduzca la descripción de la imagen aquí

 1
Author: riguang zheng,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-17 09:05:56