iochinome
August 10th, 2009, 09:34 PM
hey guys, so for the longest time in development with this little project ive been doing, i have just been doing simple #includes with .cpp files to simplify everything. sadly, i didnt turn to makefiles or even header files. just now i am making the transition. there are a few files involved, so i tried to make a makefile to simplify everything. the file containing main() is called main()
what i want to do is to also link in the necessary SDL files- it uses the SDL library, and, in the past, i have just taken the output of the command
sdl-config --cflags --libs
and appended it to the end of the
g++ -o program main.cpp
command. how do i work this into my makefile? here is what i have so far:
OBJS = main.o image_process.o controls.o
CC = g++
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
SDLFLAGS = sdl-config --cflags --libs [IS THIS HOW I WOULD DO IT?]
program: $(OBJS)
$(CC) -o $(LFLAGS) $(OBJS) fovea
main.o: main.cpp main.h image_process.h controls.h
$(CC) $(CFLAGS) fovea.cpp
image_process.o: image_process.cpp image_process.h
$(CC) $(CFLAGS) image_process.cpp
controls.o: controls.cpp controls.h
$(CC) $(CFLAGS) controls.cpp
thanks guys!
what i want to do is to also link in the necessary SDL files- it uses the SDL library, and, in the past, i have just taken the output of the command
sdl-config --cflags --libs
and appended it to the end of the
g++ -o program main.cpp
command. how do i work this into my makefile? here is what i have so far:
OBJS = main.o image_process.o controls.o
CC = g++
DEBUG = -g
CFLAGS = -Wall -c $(DEBUG)
LFLAGS = -Wall $(DEBUG)
SDLFLAGS = sdl-config --cflags --libs [IS THIS HOW I WOULD DO IT?]
program: $(OBJS)
$(CC) -o $(LFLAGS) $(OBJS) fovea
main.o: main.cpp main.h image_process.h controls.h
$(CC) $(CFLAGS) fovea.cpp
image_process.o: image_process.cpp image_process.h
$(CC) $(CFLAGS) image_process.cpp
controls.o: controls.cpp controls.h
$(CC) $(CFLAGS) controls.cpp
thanks guys!