Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Makefile review


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 wood_brian   Banned   -  Reputation: 197

Like
0Likes
Like

Posted 30 April 2011 - 02:29 PM

Here's a copy of one of my makefiles:

CC=g++
AR=ar
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

clean:
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
http://webEbenezer.net

Sponsor:

#2 KulSeran   Members   -  Reputation: 2563

Like
1Likes
Like

Posted 30 April 2011 - 04:18 PM

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/).




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS