LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-07-2005, 01:36 AM   #1
MS3FGX
LQ Guru
 
Registered: Jan 2004
Location: NJ, USA
Distribution: Slackware, Debian
Posts: 5,852

Rep: Reputation: 361Reputation: 361Reputation: 361Reputation: 361
Makefile works on one system, but not another


Me and a few others are working on a software library for the Nintendo GameCube, and are trying to create a standardized way to compile code for it.

The current problem is that we have a Makefile that compiles programs on one developers machine perfectly (FC3) and fails on my system (Slackware 9.0, with the latest GCC, binutil, make, and automake).

On my system I get the following error:

Code:
Makefile:103: *** missing separator.  Stop.
Nobody is quite sure why this Makefile fails on my machine, and we don't know if it works on other machines (anyone who is willing to give it a shot, post your results).

Here is the Makefile, any help would be appreciated.

Code:
#---------------------------------------------------------------------------------
# Clear the implicit built in rules
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# TARGET is the name of the output, if this ends with _mb generates a multiboot image
# BUILD is the directory where object files & intermediate files will be placed
# SOURCES is a list of directories containing source code
# INCLUDES is a list of directories containing extra header files
#---------------------------------------------------------------------------------
TARGET          :=      snes9xgc
BUILD           :=      build
SOURCES         :=      source
INCLUDE         :=      ~/devkitPPC/include

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------

MACHDEP = -DGEKKO -DINLINE_SET_GET -mcpu=750 -meabi -mhard-float
CFLAGS = -O2 -Wall $(MACHDEP) $(INCLUDES)

#CFLAGS :=      -O3 -Wa,-mregnames -Wall $(INCLUDE)
#ASFLAGS        :=      -Wa,-mregnames $(INCLUDE)

LDFLAGS =       $(MACHDEP) -mogc -Wl,-Map,$(notdir $@).map

#---------------------------------------------------------------------------------
# path to tools - this can be deleted if you set the path in windows
#---------------------------------------------------------------------------------
# export PATH := /devkitPPC/bin:/bin
#---------------------------------------------------------------------------------
# absolute path required since this makefile uses the build directory
# as the working directory
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
# the prefix on the compiler executables
#---------------------------------------------------------------------------------
PREFIX                  :=      powerpc-elf-
#---------------------------------------------------------------------------------
# any extra libraries we wish to link with the project
#---------------------------------------------------------------------------------
LIBS    :=      -logcsys -logc -lm

#---------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level containing
# include and lib
#---------------------------------------------------------------------------------
LIBDIRS := #/~/devkitPPC:~/devkitPPC/lib

#---------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
# rules for different file extensions
#---------------------------------------------------------------------------------
ifneq ($(BUILD),$(notdir $(CURDIR)))
#---------------------------------------------------------------------------------

export OUTPUT   :=      $(CURDIR)/$(TARGET)

export VPATH    :=      $(foreach dir,$(SOURCES),$(CURDIR)/$(dir))

export CC               :=      $(PREFIX)gcc
export CXX              :=      $(PREFIX)g++
export AR               :=      $(PREFIX)ar
export OBJCOPY  :=      $(PREFIX)objcopy
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
export LD       :=      $(CXX)
#export LD      :=      $(CC)

#---------------------------------------------------------------------------------
# automatically build a list of object files for our project
#---------------------------------------------------------------------------------
CFILES          :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES        :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
sFILES          :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
SFILES          :=      $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.S)))

export OFILES   := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(sFILES:.s=.o) $(SFILES:.S=.o)
#export OFILES  :=      gx_demo.o spaceship.o texture.o incbin.o
#---------------------------------------------------------------------------------
# build a list of include paths
#---------------------------------------------------------------------------------
export INCLUDES :=      $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
                                       $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
                                       -I$(CURDIR)/$(BUILD) \
                                       -I$(CURDIR)/$(INCLUDE)

#---------------------------------------------------------------------------------
# build a list of library paths
#---------------------------------------------------------------------------------
export LIBPATHS :=      $(foreach dir,$(LIBDIRS),-L$(dir)/lib)

export OUTPUT   :=      $(CURDIR)/$(TARGET)
.PHONY: $(BUILD) clean

#---------------------------------------------------------------------------------
$(BUILD):
       @[ -d $@ ] || mkdir -p $@
       @make --no-print-directory -C $(BUILD) -f $(CURDIR)/Makefile

#---------------------------------------------------------------------------------
clean:
       @echo clean ...
       @rm -fr $(BUILD) *.elf
       @rm snes9xgc.dol

#---------------------------------------------------------------------------------
else

DEPENDS :=      $(OFILES:.o=.d)

#---------------------------------------------------------------------------------
# main targets
#---------------------------------------------------------------------------------
$(OUTPUT).dol: $(OUTPUT).elf
       @echo output ... $(notdir $@)
       @$(OBJCOPY)  -O binary $< $@

#---------------------------------------------------------------------------------
$(OUTPUT).elf: $(OFILES)
       @echo linking ... $(notdir $@)
       @$(LD)  $^ $(LDFLAGS) $(LIBPATHS) $(LIBS) -o $@

#---------------------------------------------------------------------------------
# Compile Targets for C/C++
#---------------------------------------------------------------------------------

#---------------------------------------------------------------------------------
%.o : %.cpp
       @echo $(notdir $<)
       @$(CXX) -MMD $(CFLAGS) -o $@ -c $<

#---------------------------------------------------------------------------------
%.o : %.c
       @echo $(notdir $<)
       @$(CC) -MMD $(CFLAGS) -o $@ -c $<

#---------------------------------------------------------------------------------
%.o : %.S
       @echo $(notdir $<)
       @$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@

#---------------------------------------------------------------------------------
%.o : %.s
       @echo $(notdir $<)
       @$(CC) -MMD $(CFLAGS) -D_LANGUAGE_ASSEMBLY -c $< -o $@

#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
       cp $(<) $(*).tmp
       $(OBJCOPY) -I binary -O elf32-powerpc -B powerpc \
       --rename-section .data=.rodata,readonly,data,contents,alloc \
       --redefine-sym _binary_$*_tmp_start=$*\
       --redefine-sym _binary_$*_tmp_end=$*_end\
       --redefine-sym _binary_$*_tmp_size=$*_size\
       $(*).tmp $(@)
       echo "extern const u8" $(*)"[];" > $(*).h
       echo "extern const u32" $(*)_size[]";" >> $(*).h
       rm $(*).tmp
endef

-include $(DEPENDS)

#---------------------------------------------------------------------------------
endif
#---------------------------------------------------------------------------------
 
Old 01-07-2005, 04:17 AM   #2
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
looks like you aren't using tabs.
like

Code:
target: dependency
[TAB]blah
[TAB]blah
did you cut and paste the file?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ask for dnsmasq configuration example(really works on your system) pundun Linux - Networking 0 11-23-2005 09:30 PM
how to get (makefile -f makefile )output into the textview widget in Pygtk sailu_mvn Programming 3 02-28-2005 03:57 AM
what sound system works with realplayer darkleaf Linux - Software 5 11-19-2004 02:11 PM
new system call, modify Makefile for .o feetyouwell Programming 0 11-16-2004 09:58 AM
generate Makefile from Makefile.in without calling ./configure ? chris78 Programming 2 05-02-2004 12:23 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration