Visit Our UNIX and Linux User Community


Makefile cannot find separator


 
Thread Tools Search this Thread
Top Forums Programming Makefile cannot find separator
# 1  
Old 11-22-2018
Makefile cannot find separator

Hello. I recently have been trying to use the autotools in a already existing program that I used an IDE before. I started to follow this tutorial: autoconf automake tutorial

And it was going well until came the hour of I assuming the end-user job. ./configure runned ok, but when I typed "make" in the top level directory, I received this:

Code:
make
make  all-recursive
make[1]: Entering directory `/media/34GB/demos/asmfrt'
Making all in src
make[2]: Entering directory `/media/34GB/demos/asmfrt/src'
Makefile:510: *** missing separator.  Stop.
make[2]: Leaving directory `/media/34GB/demos/asmfrt/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/media/34GB/demos/asmfrt'
make: *** [all] Error 2

I opened the makefile in the src dir, went to line 510 and I saw this:

Code:
.

Yes, there is a single '.' in the line

The previous line is a blank line and the succeeding line is another '.'

So, what might be going on and how to fix it. Thanks for your time
# 2  
Old 11-23-2018
Quite likely autoconf, automake, and libtool have broken backwards compatibility with themselves again. They do this every few years without fail. I've had similar experiences with IDE's depending upon them. They do not last.

If you're lucky, you can upgrade your package with autoreconf followed by libtoolize --force, but this is a long shot. autoconf and automake have been been outpacing moore's law in complexity and brokenness for over 20 years.
Image

It may be far better to take 5 minutes to write a simple makefile yourself than spend 3 months fighting this monstrous, obsolete code generator-generator-generator.
# 3  
Old 11-23-2018
Quote:
Originally Posted by Corona688
Quite likely autoconf, automake, and libtool have broken backwards compatibility with themselves again. They do this every few years without fail. I've had similar experiences with IDE's depending upon them. They do not last.

If you're lucky, you can upgrade your package with autoreconf followed by libtoolize --force, but this is a long shot. autoconf and automake have been been outpacing moore's law in complexity and brokenness for over 20 years.
Image

It may be far better to take 5 minutes to write a simple makefile yourself than spend 3 months fighting this monstrous, obsolete code generator-generator-generator.
hummm. I will try this tutorial first: A Simple Makefile Tutorial About the configure, shall I keep it? It generated a broken Makefile....
# 4  
Old 11-24-2018
Based on the above tutorial I created this Makefile

Code:
CFLAGS=-I.
DEPS = PerformanceManager.h InputHandler.h Vec3f.h Image.h FileManager.h GeometricObjects.h TGAManager.h Plane.h Sphere.h Triangle.h Scene.h TextManager.h RayTracer.h
OBJ = PerformanceManager.o  InputHandler.o Image.o FileManager.o TGAManager.o Plane.o Scene.o TextManager.o RayTracer.o main.o

%.o: %.cpp $(DEPS)
    g++ -c -o $@ $< $(CFLAGS)

RayTracer: $(OBJ) 
    g++ -O3 -fexpensive-optimizations --fast-math -lpthread -o $@ $^ $(CFLAGS)

clean:
    rm -rf *.o

It works, but it's not using the compiler flags to speedup the code. I realisz that the problem is that the flags are in the wrong place, they should be before the .o files are created. I guess I shall put them in the CFLAGS? I read somewhere that since the CFLAGS are made to be adjusted by the end-user, it's a bad practice to set them in the Makefile. If that is the case, where should I put the compiler flags?

Besides that, I do not comprehend the purpose of "-I". The tutorial says
Quote:
The -I. is included so that gcc will look in the current directory (.) for the include file hellomake.h.
. But doesn't always gcc looks in the current directory for .h files? As far as I know, it's the double "" around a .h file that makes gcc look in the current directory for the file, if it was <>, it would look for them in the global directories like /usr/include.
# 5  
Old 11-25-2018
Quote:
Originally Posted by colt
Besides that, I do not comprehend the purpose of "-I". [...] But doesn't always gcc looks in the current directory for .h files?
Not gcc but actually cpp. It is convenient to think of the compiler as one huge, monolithic program but this is not the case. And the preprocessor - cpp - is the first one in the chain that devours source code and digests it to executable code.

You can actually bring cpp to show you the default location(s) it would look at for header files by issuing cpp -v. The relevant part of the output would look similar to (the redirection is necessary, otherwise it waits for input):

Code:
$ cpp -v < /dev/null
[...]
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/7/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/7/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
[...]

Quote:
Originally Posted by colt
As far as I know, it's the double "" around a .h file that makes gcc look in the current directory for the file, if it was <>, it would look for them in the global directories like /usr/include.
Apart from"see above", this is "more or less correct but not quite". ;-)) In fact the preprocessor doesn't look in the current directory but the one where the source file is located. If you compile a source file in the current directory (which is mostly the case) this makes no difference but if you do:

Code:
user@host:/my/current/directory> gcc -c /some/where/myprogram.c

and in the source there is the line #include "myprogram.h" then cpp would look in /some/where/ for myprogram.h and not your current directory /my/current/directory. I suppose this makes a lot more sense than if it would be the other way round.

Regarding your question about the location of CFLAGS: be aware that the construction of the commandline is done simply by text replacement. Where the name of a variable (like $(CFLAGS)) stands it is replaced by the content of that variable. The called program will only "see" the result of these replacements, so ask yourself: would the resulting compiler call be syntactically correct or not?

I hope this helps.

bakunin
# 6  
Old 11-26-2018
Quote:
Originally Posted by colt
It works, but it's not using the compiler flags to speedup the code. I realize that the problem is that the flags are in the wrong place, they should be before the .o files are created. I guess I shall put them in the CFLAGS?
Yes.
Quote:
I read somewhere that since the CFLAGS are made to be adjusted by the end-user, it's a bad practice to set them in the Makefile.
Your makefile is less than ten lines, it is easily adjusted by whoever wants it to, as makefiles should be.

Previous Thread | Next Thread
Test Your Knowledge in Computers #682
Difficulty: Easy
Steve Job's was the primary founder and majority shareholder of Pixar
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Separator

Hello everybody, I'll get one more help I have a cabundle file that I need to separate into 2 parts, the first sequence and the second sequence, I thought of several things but I did not remember anything that could actually accomplish this separation and transform into 2 variables, first... (4 Replies)
Discussion started by: c0i0t3
4 Replies

2. Shell Programming and Scripting

Field separator

Hello All, I have a file, but I want to separate the file at a particular record with comma"," in the line Input file APPLE6SSAMSUNGS5PRICEPERPIECEDOLLAR600EACH010020340URX581949695US to Output file APPLE6S,SAMSUNGS5,PRICEPERPIECE,DOLLAR600EACH,010020340URX581949695,US This is for... (11 Replies)
Discussion started by: m6248m
11 Replies

3. Shell Programming and Scripting

Find "*.c" and "Makefile" and then delete them with one line

find "*.c" and "Makefile" and then delete them with one line (3 Replies)
Discussion started by: yanglei_fage
3 Replies

4. UNIX for Dummies Questions & Answers

GCC Makefile-Missing Separator

Hello, I am attempting to build gcc 4.0.4 on my Mac (OS X). When I use the "make" command, it returns with something like this: Makefile:6089: *** missing separator. Stop. This means that at the given line, I must go into the file and insert a TAB before the contents of that line. I have... (1 Reply)
Discussion started by: Tyler_92
1 Replies

5. Homework & Coursework Questions

Help with Simple Multi-Level Makefile (Extremely New at Makefile)

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Basically, the prompt is make a makefile with various sub makefiles in their respective subdirectories. All code... (1 Reply)
Discussion started by: Tatl
1 Replies

6. UNIX for Dummies Questions & Answers

Issues with Makefile (cannot find )

Hello guys ! Need a bit of help is compiling a code, the makefile for which was originally designed to work on a 32-bit Linux platform, for a 64-bit Linux platform. My platform is Ubuntu 10.04 LTS 64-bit. I am trying to compile a code called csim, file name csim-1.1.tar.gz. To compile this... (0 Replies)
Discussion started by: pbhat
0 Replies

7. UNIX for Advanced & Expert Users

Makefile executing another Makefile first?

I have 2 libraries in 2 different directories that I build with Makefiles. library B depends on library A. If I modify a .cpp file in library A and run lib B's Makefile can I have B's makefile to automatically rebuild library A? I am now rebuilding A, followed by B... but I'd like B to... (0 Replies)
Discussion started by: wwuster
0 Replies

8. UNIX for Advanced & Expert Users

Makefile problem - How to run module load in a Makefile

Hi, I'm trying to run the module load command in a Makefile and i'm getting the following error: make: module: command not found Why is this? Is there any way to run this command in a Makefile? NOTE: command - module load msjava/sunjdk/1.5.0 works fine outside of the Makefile (2 Replies)
Discussion started by: hernandinho
2 Replies

9. UNIX for Dummies Questions & Answers

Help with unix separator

can some one give me a list of unix separtor(s) if one than just the separator please thank you. (2 Replies)
Discussion started by: Black mage2021
2 Replies

10. Shell Programming and Scripting

Separator in Makefile?

all: $(LIBRARY) $(EXE) $(MAKEMAKE): @rm -f $(MAKEMAKE) $(PURIFY) $(CXX) -M $(INCLUDE) $(CPPFLAGS) *.cpp > $(MAKEMAKE) $(EXE): $(OBJS) $(LIBRARY) @echo "Creating a executable " $(PURIFY) $(CC) -o $(EXE) $(OBJS) $(ALLLDFLAGS) $(LIBS) This is a snippet... (2 Replies)
Discussion started by: laila63
2 Replies

Featured Tech Videos