Home > database >  Missing separator in generated Makefile
Missing separator in generated Makefile

Time:05-16

I'm trying to compile this decade-old project: https://github.com/komar007/freecg

The makefile generates Makefile.dep which seems incorrectly formatted. How should I change the makefile so that the Makefile.dep gets generated correctly?

nino@nino-ubuntu:~/StudioProjects/freecg$ make
make cgl_view
make[1]: Entering directory '/home/nino/StudioProjects/freecg'
Makefile.dep:1: *** missing separator.  Stop.
make[1]: Leaving directory '/home/nino/StudioProjects/freecg'
make: *** [Makefile:10: all] Error 2

The below output shows line endings($) and tabs (^I)

nino@nino-ubuntu:~/StudioProjects/freecg$ cat -e -t -v Makefile
CC=gcc -g -ggdb$
WARN=-Wall -Wextra$
LIBS=-lm `sdl-config --libs` -lGL -lSDL_image$
CFLAGS=`sdl-config --cflags` -O2 -pedantic -std=c99 $(WARN)$
SOURCES=cgl.c gfx.c cgl_view.c graphics.c texmgr.c cg.c geometry.c osd.c osdlib.c$
HEADERS=cgl.h gfx.h texmgr.h graphics.h cg.h mathgeom.h basic_types.h osd.h osdlib.h$
FILES=$(SOURCES) $(HEADERS)$
$
all: dep$
^Imake cgl_view$
$
dep:$
^I@echo -en > Makefile.dep$
^I@for s in $(SOURCES); do \$
^I^Igcc -M $$s >> Makefile.dep; \$
^I^Iecho -e '\t'@echo CC $$s >> Makefile.dep; \$
^I^Iecho -e '\t'@$(CC) $(CFLAGS) -c $$s >> Makefile.dep; \$
^Idone$
$
-include Makefile.dep$
$
cgl_view: cgl_view.o cgl.o gfx.o graphics.o texmgr.o cg.o geometry.o osd.o osdlib.o$
^I@echo LINK freecg$
^I@$(CC) $(LIBS) -o cgl_view $^$
$
clean:$
^Irm -fr *.o cgl_view$
nino@nino-ubuntu:~/StudioProjects/freecg$ cat -e -t -v Makefile.dep 
-en$
cgl.o: cgl.c /usr/include/stdc-predef.h cgl.h mathgeom.h \$
 /usr/include/assert.h /usr/include/features.h \$
 /usr/include/x86_64-linux-gnu/sys/cdefs.h \$
 /usr/include/x86_64-linux-gnu/bits/wordsize.h \$
 /usr/include/x86_64-linux-gnu/bits/long-double.h \$
 /usr/include/x86_64-linux-gnu/gnu/stubs.h \$
 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h /usr/include/stdlib.h \$
 /usr/include/x86_64-linux-gnu/bits/libc-header-start.h \$
 /usr/lib/gcc/x86_64-linux-gnu/9/include/stddef.h \$
 /usr/include/x86_64-linux-gnu/bits/waitflags.h \$
 /usr/include/x86_64-linux-gnu/bits/waitstatus.h \$
 /usr/include/x86_64-linux-gnu/bits/floatn.h \$
 /usr/include/x86_64-linux-gnu/bits/floatn-common.h \$
 /usr/include/x86_64-linux-gnu/sys/types.h \$
 /usr/include/x86_64-linux-gnu/bits/types.h \$
 /usr/include/x86_64-linux-gnu/bits/timesize.h \$
 /usr/include/x86_64-linux-gnu/bits/typesizes.h \$
 /usr/include/x86_64-linux-gnu/bits/time64.h \$
 /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/time_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/timer_t.h \$
 /usr/include/x86_64-linux-gnu/bits/stdint-intn.h /usr/include/endian.h \$
 /usr/include/x86_64-linux-gnu/bits/endian.h \$
 /usr/include/x86_64-linux-gnu/bits/endianness.h \$
 /usr/include/x86_64-linux-gnu/bits/byteswap.h \$
 /usr/include/x86_64-linux-gnu/bits/uintn-identity.h \$
 /usr/include/x86_64-linux-gnu/sys/select.h \$
 /usr/include/x86_64-linux-gnu/bits/select.h \$
 /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h \$
 /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h \$
 /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h \$
 /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h \$
 /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h \$
 /usr/include/x86_64-linux-gnu/bits/struct_mutex.h \$
 /usr/include/x86_64-linux-gnu/bits/struct_rwlock.h /usr/include/alloca.h \$
 /usr/include/x86_64-linux-gnu/bits/stdlib-float.h gfx.h \$
 /usr/include/SDL/SDL.h /usr/include/SDL/SDL_main.h \$
 /usr/include/SDL/SDL_stdinc.h /usr/include/SDL/SDL_config.h \$
 /usr/include/SDL/SDL_platform.h /usr/include/stdio.h \$
 /usr/lib/gcc/x86_64-linux-gnu/9/include/stdarg.h \$
 /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/__FILE.h \$
 /usr/include/x86_64-linux-gnu/bits/types/FILE.h \$
 /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h \$
 /usr/include/x86_64-linux-gnu/bits/stdio_lim.h \$
 /usr/include/x86_64-linux-gnu/bits/sys_errlist.h /usr/include/string.h \$
 /usr/include/x86_64-linux-gnu/bits/types/locale_t.h \$
 /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h \$
 /usr/include/strings.h /usr/include/inttypes.h \$
 /usr/lib/gcc/x86_64-linux-gnu/9/include/stdint.h /usr/include/stdint.h \$
 /usr/include/x86_64-linux-gnu/bits/wchar.h \$
 /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h /usr/include/ctype.h \$
 /usr/include/iconv.h /usr/include/SDL/begin_code.h \$
 /usr/include/SDL/close_code.h /usr/include/SDL/SDL_audio.h \$
 /usr/include/SDL/SDL_error.h /usr/include/SDL/SDL_endian.h \$
 /usr/include/SDL/SDL_mutex.h /usr/include/SDL/SDL_thread.h \$
 /usr/include/SDL/SDL_rwops.h /usr/include/SDL/SDL_cdrom.h \$
 /usr/include/SDL/SDL_cpuinfo.h /usr/include/SDL/SDL_events.h \$
 /usr/include/SDL/SDL_active.h /usr/include/SDL/SDL_keyboard.h \$
 /usr/include/SDL/SDL_keysym.h /usr/include/SDL/SDL_mouse.h \$
 /usr/include/SDL/SDL_video.h /usr/include/SDL/SDL_joystick.h \$
 /usr/include/SDL/SDL_quit.h /usr/include/SDL/SDL_loadso.h \$
 /usr/include/SDL/SDL_timer.h /usr/include/SDL/SDL_version.h cg.h \$
 /usr/include/SDL/SDL_error.h /usr/include/math.h \$
 /usr/include/x86_64-linux-gnu/bits/math-vector.h \$
 /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h \$
 /usr/include/x86_64-linux-gnu/bits/flt-eval-method.h \$
 /usr/include/x86_64-linux-gnu/bits/fp-logb.h \$
 /usr/include/x86_64-linux-gnu/bits/fp-fast.h \$
 /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h \$
 /usr/include/x86_64-linux-gnu/bits/mathcalls.h /usr/include/errno.h \$
 /usr/include/x86_64-linux-gnu/bits/errno.h /usr/include/linux/errno.h \$
 /usr/include/x86_64-linux-gnu/asm/errno.h \$
 /usr/include/asm-generic/errno.h /usr/include/asm-generic/errno-base.h$
-e ^I@echo CC cgl.c$
-e ^I@gcc -g -ggdb -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -O2 -pedantic -std=c99 -Wall -Wextra -c cgl.c$
gfx.o: gfx.c /usr/include/stdc-predef.h gfx.h /usr/include/SDL/SDL.h \$
 /usr/include/SDL/SDL_main.h /usr/include/SDL/SDL_stdinc.h \$
 /usr/include/SDL/SDL_config.h /usr/include/SDL/SDL_platform.h \$
 /usr/include/x86_64-linux-gnu/sys/types.h /usr/include/features.h \$
 /usr/include/x86_64-linux-gnu/sys/cdefs.h \$
 /usr/include/x86_64-linux-gnu/bits/wordsize.h \$
 /usr/include/x86_64-linux-gnu/bits/long-double.h \$
 /usr/include/x86_64-linux-gnu/gnu/stubs.h \$
 /usr/include/x86_64-linux-gnu/gnu/stubs-64.h \$
 /usr/include/x86_64-linux-gnu/bits/types.h \$
 /usr/include/x86_64-linux-gnu/bits/timesize.h \$
 /usr/include/x86_64-linux-gnu/bits/typesizes.h \$
 /usr/include/x86_64-linux-gnu/bits/time64.h \$
 /usr/include/x86_64-linux-gnu/bits/types/clock_t.h \$
[continued..]


CodePudding user response:

Answer in the comments:

The problem seems to be echo -e. Your Make uses a shell whose echo does not recognize the -e option, so it echoes "-e" into the target file along with the rest of the text. The -e flags don't look necessary; try removing them from the dep rule, and see if that works.

CodePudding user response:

This is a very old and very badly written makefile you are trying to use. I know because I wrote it myself 12 years ago:). It requires bash, which is not the default shell GNU make chooses in many distributions. I'll fix this makefile if I have the time, but as a workaround, you can add:

SHELL=/bin/bash

at the top of the makefile to fix the problem.

  • Related