Makefile help

Apprentice
Posts: 6
Joined: 2008.05
Post: #1
I've never made a makefile before but its really silly that I'm not since I'm using a shell script to do what a makefile should do.

So without further to do... I'm confused on how to add SDLMain.m and its respective header into a make file. So here is what I've got so far...

Code:
CFLAGS= -Wall

LIBS=-I/Library/Frameworks/SDL.framework/Headers -framework SDL -framework Cocoa
OBJS=SDLMain.o main.o particle.o background.o resources.o
CC=gcc

.PHONY: clean default

default:
    @echo 'Plese check the variables at the top of the Makefile, then run make pw.'

clean:
    rm -f pw $(OBJS)
    rm -f *~

pw: $(OBJS)
    $(CC) $(CFLAGS) $(OBJS) -o pw $(LIBS)

SDLMain.o: SDLMain.m SDLMain.h
    $(CC) $(CFLAGS) -c SDLMain.m
main.o:  main.c gamedefs.h
    $(CC) $(CFLAGS) -c main.c

particle.o: particle.c particle.h gamedefs.h
    $(CC) $(CFLAGS) -c particle.c

background.o: background.c background.h gamedefs.h
    $(CC) $(CFLAGS) -c background.c

resources.o: resources.c resources.h gamedefs.h
    $(CC) $(CFLAGS) -c resources.c

This make file is an edit to what was for a linux machine so I'm sure that there is probably more than one thing wrong with it..

Also, If you have any known tutorials that you can swear by that you can share with me that would be humbly appreciated. Rolleyes
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #2
I see nothing wrong except that the -I argument you have in LIBS needs to be in CFLAGS
Quote this message in a reply
Apprentice
Posts: 6
Joined: 2008.05
Post: #3
I'm getting a bunch of Not a target errors like

Quote:# Not a target:
.tex.dvi:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (built-in):
$(TEX) $<

# Not a target:
.cpp.o:
# Implicit rule search has not been done.
# Modification time never checked.
# File has not been updated.
# commands to execute (built-in):
$(COMPILE.cpp) $(OUTPUT_OPTION) $<

probably every built-in thing is on this list along with the files I included in the Makefile.. This happens with the -I option in both spots...

Gonna do some more google work.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #4
You're running GNU make not bsdmake, right? And you've got tabs, not spaces in your Makefile? And you didn't pass any options to make?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Makefile setup JeroMiya 2 2,460 Apr 24, 2007 10:31 PM
Last Post: OneSadCookie
  Configuring a makefile for OpenGL / GLUT zed_katarn 4 4,431 Feb 15, 2006 03:45 PM
Last Post: zed_katarn