| |
 | Posted by Ronald Weidner in reply to Cesar Rabak | Permalink Reply |
|
Ronald Weidner 
Posted in reply to Cesar Rabak
| == Quote from Cesar Rabak (crabak@acm.org)'s article
> Ronald Weidner escreveu:
> > # Simple Make File for many projects. Just modify
> > # line 4 - 10 for your project and you're done!
> I would require modification of more lines if:
> DM is not installed in C:\DM
> if you invoke the make from a drive diferent than C: since your
> macro for include does not have the drive letter...
That's correct. If someone wanted to use this make file, they would need to "fix" it to match their project and system configuration. I wrote this to be a "light touch" makefile where this makefile could be copied, slightly edited, and used again for many C++ projects. I could probably make this even more generic with even less need to edit. The trade off is that the makefile may become more complicated/cryptic and harder to extend.
It's my anticipation that this simple make file will be sufficient for 80% of my utilities and tests. I'll only need to modify SRC for each project. (since my last post I added a line for Defines). Additional modification would be needed for more complicated source trees such as multi-language projects, dll/lib creation, etc.
Perhaps I should call this makefile a nice starting point.
Currently I maintain several complex systems for the company I work for. The code base spans 15 years of development by scores of programmers. I've recently revamped all the makefiles for my company to something that isn't much more complicated than this make file.
> >
> > CC=c:\dm\bin\dmc.exe
> > SRC=Inheritence.cpp
> > CFLAGS=
> > LINK=
> > INCLUDE=-I\dm\stlport\stlport
> > EXE=Inheritence.exe
> > RM=del
> >
> > ...
> >
> > tidy: all
> > - ${RM} ${OBJS}
> > - ${RM} ${MAPS}
> A call to make tidy will first call building of the
> target, is this what you intent?
Yes, this was the intent. I wanted a one shot call to make to build the exe and clean up files that aren't needed anymore. If I use make tidy it's probably because I'm going to zip up the folder and send it somewhere when build is complete.
> >
> > rebuild: clean all
> Make takes care of only compiling and linking if
> necessary if sources are newer that object files,
> then why do you created a 'rebuild' that cleans
> all objects?
This is now more out of habit and perhaps paranoia. When I want to be absolutely certain that my exe is the most up to date I run rebuild. Basically, the fear is that some external force (such as a version control system) may mess up make's ability to build correctly. By deleting all obj files make is free from potentially making a bad decision. It will rebuild everything. (Brute force approach) I always rebuild before I bundle a release.
> > # Remember, all indentations must be tabs... not spaces.
|