Re: Why is make building all targets
- From: Gene Hightower <gene@xxxxxxxxxxxxxxx>
- Date: Mon, 11 Jun 2007 22:19:42 -0700
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I realize that your original question has been answered (a few times
over) but now, days later, I tossed this make file together:
VPATH = src:inc:../src:../inc
CXXFLAGS += -Iinc -I../inc -O2 -Wall -MMD
STEMS = main Mod1 Mod2
OBJS = $(patsubst %,%.o,$(STEMS))
DEPS = $(patsubst %,%.d,$(STEMS))
llfd : $(OBJS)
$(CXX) -o $@ $^
clean:
rm -f llfd $(OBJS) $(DEPS)
include $(DEPS)
%.d:
@touch $@
OK, so a command you might use to build your project is:
$ ARCH=`uname -i` mkdir $ARCH ; make -f ../Makefile -C $ARCH
You could also build in the src directory with "make -f ../Makefile"
or from the top level with just "make". Gives you some flexibility
about what directory you run the make from.
I like to make the compiler keep track of the dependencies for me.
You also don't need a main.h unless you want one.
It's been a while since I've used raw make (I've been automake-ing
recently) so I'm sure there's room for improvement.
Enjoy,
-- Gene
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFGbizt+6lOFXNSgQwRAm8FAKDhpba6DjJTIyPgpolZ67oy6jAbVQCgxFfq
0EYv5jilSO4mlQmomZFw6ro=
=B0zF
-----END PGP SIGNATURE-----
.
- References:
- Why is make building all targets
- From: Andrew Falanga
- Why is make building all targets
- Prev by Date: getting position of mouse in curses
- Next by Date: Re: Solaris Thread Limit -- Interesting one.
- Previous by thread: Re: Why is make building all targets
- Next by thread: Re: (HP-UX)How to get the path in which contains current process's image file.
- Index(es):