![]() |
| | #1 |
| Registered User Join Date: Oct 2002
Posts: 5
| Question About Makefiles Code:
Prog1: main.o Rational.o test.o
g++ -Wall -W -Werror main.o Rational.o test.o -o Prog1
main.o: main.cc Rational.h
g++ -Wall -W -Werror -c main.cc -o Rational.o
Rational.o: Rational.cc Rational.h
g++ -Wall -W -Werror -c Rational.cc -o Rational.o
test.o: test.cc Rational.h
g++ -Wall -W -Werror -c test.cc -o test.o
|
| -dcx- is offline | |
| | #2 |
| Registered User Join Date: Aug 2001
Posts: 244
| Code: Prog1: main.o Rational.o test.o
g++ -Wall -W -Werror main.o Rational.o test.o -o Prog1
main.o: main.cc Rational.h
g++ -Wall -W -Werror -c main.cc
Rational.o: Rational.cc Rational.h
g++ -Wall -W -Werror -c Rational.cc
test.o: test.cc Rational.h
g++ -Wall -W -Werror -c test.cc
|
| Captain Penguin is offline | |
| | #3 |
| Registered User Join Date: Sep 2002
Posts: 69
| You might like to use variables at the top of the file so you don't have to change everything in every line. Just makes neater code. Example: Code: CFLAGS=-W -Wall -ggdb `sdl-config --cflags` LIBS=-lm `sdl-config --libs` OBJS=main.o particle.o background.o resources.o CC=g++ default: @echo 'Plese check the variables at the top of the Makefile, then run make program.' clean: rm -f program $(OBJS) rm -f *~ program: $(OBJS) $(CC) $(CFLAGS) $(OBJS) -o program $(LIBS) main.o: main.cpp gamedefs.h $(CC) $(CFLAGS) -c main.cpp particle.o: particle.cpp particle.h gamedefs.h $(CC) $(CFLAGS) -c particle.cpp background.o: background.cpp background.h gamedefs.h $(CC) $(CFLAGS) -c background.cpp resources.o: resources.cpp resources.h gamedefs.h $(CC) $(CFLAGS) -c resources.cpp
__________________ D. Olson The Mandrake eXPerience Battle Pong IDE: kate 2.0 Compiler: gcc 3.2 Graphics/Input/Net: SDL 1.2.5 (pdf) 3D Audio: OpenAL (pdf) I am a signature virus. Please add me to your signature so that I may multiply |
| DOlson is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Question about pointers #2 | maxhavoc | C++ Programming | 28 | 06-21-2004 12:52 PM |
| Question... | TechWins | A Brief History of Cprogramming.com | 16 | 07-28-2003 09:47 PM |
| opengl DC question | SAMSAM | Game Programming | 6 | 02-26-2003 09:22 PM |
| Question about linked lists. | cheeisme123 | C++ Programming | 6 | 02-25-2003 01:36 PM |
| Question, question! | oskilian | A Brief History of Cprogramming.com | 5 | 12-24-2001 01:47 AM |