Jump to content
  • Advertisement
Sign in to follow this  

Makefile review

This topic is 2702 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here's a copy of one of my makefiles:

LIBS=-L./ -L/usr/lib

all: libhome.a cmwAmbassador direct

account_info.o: account_info.hh
cmwa_config_data.o: cmwa_config_data.hh
common_functions.o: common_functions.hh
local_messages.cg.o: local_messages.cg.hh
remote_messages.cg.o: remote_messages.cg.hh
quicklz.o: quicklz.h
Counter.o: Counter.hh
IO.o : IO.hh
SendBuffer.o: SendBuffer.hh
SendCompressedBuffer.o: SendCompressedBuffer.hh
File.o: File.hh
marshalling_integer.o: marshalling_integer.hh

objects = account_info.o cmwa_config_data.o common_functions.o local_messages.cg.o quicklz.o Counter.o IO.o SendBuffer.o SendCompressedBuffer.o File.o marshalling_integer.o

libhome.a: $(objects)
ar r libhome.a $(objects)

cmwAmbassador: cmwAmbassador.cc libhome.a remote_messages.cg.o
g++ -o cmwAmbassador $(CPPFLAGS) cmwAmbassador.cc remote_messages.cg.o libhome.a
ls -l cmwAmbassador

direct: direct.cc libhome.a
g++ -o direct $(CPPFLAGS) direct.cc libhome.a
ls -l direct

rm -f $(objects) remote_messages.cg.o libhome.a cmwAmbassador direct

-------------------------------- end of file --------------------------------------------------------------------

Can you give me some ideas on improving it? I'm probably going to change the name of the library, but haven't figured out what to call it yet.

There's a Windows version of the file here --http://webEbenezer.n...sc/makefile.mcr.
Thanks in advance.

Brian Wood
Ebenezer Enterprises

Share this post

Link to post
Share on other sites
I'd suggest switching to a build tool like CMake (http://www.cmake.org/). It takes a lot of the tedium out of creating makefiles, and it has the added benefits of also being able to produce project files for most IDEs, and for most compilers. And, since it supports out-of-source building you can run your builds from another directory and not clutter your source tree with object files. The out-of-source building also makes it easy to integrate with continuous integration tools like CruiseControl(http://cruisecontrol.sourceforge.net/).

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!