Makefile help!

Are there any line-compiling makefile gurus out there? (esp. from FreeBSD peeps).

I got a Makefile like:

Source & Object Files

SOURCES = Main.cpp
3DENGINE/Shining3D.cpp
FOLDER2/…cpp

OBJECTS = Main.o
3DENGINE/Shining3D.o

OUTSIDE_OBJS = CONSOLE/libSDL_console.so

Target File

TARGET = doom2d

Flags

CFLAGS = -Wall sdl-config --cflags -I /usr/X11R6/include/GL
LFLAGS = sdl-config --libs -L /usr/X11R6/lib -lGL -lGLU -lglut -lm
CPPFLAGS = $(CFLAGS)

Targets

all: $(TARGET)

$(TARGET): $(OBJECTS)
g++ -o $(TARGET) $(OBJECTS) $(LFLAGS) $(OUTSIDE_OBJS)

Dependencies

MD2.o: MD2.cpp MD2.h Math.h

(the … means etc etc). As you can see my code is in a folder hierarchy. This
Makefile compiles fine under my linux (and I think MacOSX). But when compiled
under FreeBSD (same latest g++ compiler) it doesn’t work right. You see, under
linux all the object files get put into their respective folders
(3DENGINE/…etc), and the linking process is ok. But under FreeBSD it puts all
the object files in the root folder and linking process goes “couldn’t find files”.

Is there any way to make FreeBSD keep the object output files to their
respective folders where the source codes are. There are many different code
folders.

hrm, if everything is from one makefile in the root dir of your source
code, even in linux, i would expect the objects to appear there.
shrugs well, what you can do to ensure the objs where you want is
either include cd commands or, better yet, give each subdir its own
makefile and have your master makefile simply call those makefiles.On Tue, 2003-03-04 at 05:40, K Cheng wrote:

Are there any line-compiling makefile gurus out there? (esp. from FreeBSD peeps).

I got a Makefile like:

Source & Object Files

SOURCES = Main.cpp
3DENGINE/Shining3D.cpp
FOLDER2/…cpp

OBJECTS = Main.o
3DENGINE/Shining3D.o

OUTSIDE_OBJS = CONSOLE/libSDL_console.so

Target File

TARGET = doom2d

Flags

CFLAGS = -Wall sdl-config --cflags -I /usr/X11R6/include/GL
LFLAGS = sdl-config --libs -L /usr/X11R6/lib -lGL -lGLU -lglut -lm
CPPFLAGS = $(CFLAGS)

Targets

all: $(TARGET)

$(TARGET): $(OBJECTS)
g++ -o $(TARGET) $(OBJECTS) $(LFLAGS) $(OUTSIDE_OBJS)

Dependencies

MD2.o: MD2.cpp MD2.h Math.h

(the … means etc etc). As you can see my code is in a folder hierarchy. This
Makefile compiles fine under my linux (and I think MacOSX). But when compiled
under FreeBSD (same latest g++ compiler) it doesn’t work right. You see, under
linux all the object files get put into their respective folders
(3DENGINE/…etc), and the linking process is ok. But under FreeBSD it puts all
the object files in the root folder and linking process goes “couldn’t find files”.

Is there any way to make FreeBSD keep the object output files to their
respective folders where the source codes are. There are many different code
folders.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl