1

i'm not sure why my makefiles isn't working. i googled the the error and i got some stuff about whitespaces and tabs but i'm not sure what to do.

error: makefile:17: * missing separator. Stop.

# see http://www.gnu.org/software/make/manual/make.html
#     http://www.gnu.org/software/make/manual/make.html#Automatic-Variables
CXX=g++
CXXFLAGS=-c -Wall -g
LDFLAGS=
OBJECTS= main.o Player.o Territory.o Continent.o Game.o Color.o
TITLE=ass1
ARCHIVE=$(TITLE).tar.gz

.PHONY : all clean debug valgrind archive

# make all
all: $(OBJECTS) $(TITLE)

# make ass
$(TITLE): $(OBJECTS)
$(CXX) $(LDFLAGS) -o $@ $^

# make %.o
%.o: %.cpp %.h
$(CXX) $(CXXFLAGS) $^

# make clean
clean :
rm -f *.o *.gch $(TITLE) 

# make debug
debug : $(TITLE)
cgdb ./$<

# make valgrind P0=-Test P1=0
valgrind : $(TITLE)
valgrind --tool=memcheck --leak-check=yes ./$< $(P0) $(P1)

# http://unixhelp.ed.ac.uk/CGI/man-cgi?tar
archive :
tar cfz $(ARCHIVE) --ignore-failed-read *.cpp *.h *.pdf Makefile

# additional dependencies

main.o: Continent.h Player.h Territory.h 
Player.o: Player.h
Territory.o: Territory.h
Continent.o: Continent.h
Game.o: Game.h
Color.o: Color.h
BenMorel
  • 34,448
  • 50
  • 182
  • 322
vicR
  • 789
  • 4
  • 23
  • 52
  • Does this answer your question? [Make error: missing separator](https://stackoverflow.com/questions/920413/make-error-missing-separator) – SuperStormer Feb 18 '23 at 04:30

1 Answers1

4

Your command need to be tab (not space) indented. For example,

$(TITLE): $(OBJECTS)
    $(CXX) $(LDFLAGS) -o $@ $^
^ this is a tab (in disguise...)
Alex Chamberlain
  • 4,147
  • 2
  • 22
  • 49
  • Ah... the memories of trying to figure this one out the hard way (long before SO existed). – hyde Apr 09 '13 at 18:43
  • With [makepp](http://makepp.sourceforge.net/) it just needs to be indented more than the first line. No need to worry about these archaic tab problems. – Daniel Apr 10 '13 at 21:35