Jump to content
  • Advertisement
Sign in to follow this  
spraff

Makefile question

This topic is 3659 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

Hi. Here's a stripped-down version of the makefile I'm creating:
MYLIST	= demo1 demo2

CXX		= g++
CXXFLAGS	= -pipe
LFLAGS		=
.SUFFIXES: .build

.cpp.build: $<
	$(CXX) $(CXXFLAGS) $(LFLAGS) -o "$*.build" "$<"

mylist: $(MYLIST:=.build)
The rule for mylist should expand to "mylist: demo1.build demo2.build" and trigger the .cpp.build rule. When I run this file I get
make: *** No rule to make target `demo1.build', needed by `mylist'. Stop.
Which I don't understand at all. Funny thing is I had a very similar system in another makefile a while ago and that worked then. I made a couple of minor, seemingly irrelevant changes, and now the old makefile is broken too. What am I doing wrong?

Share this post


Link to post
Share on other sites
Advertisement
Well, the easy answer is: Don't use makefiles. It's old (crappy) technology. I would suggest switching over to a CMake or SCons (Yummy Python) system. Much less hassle, and something that wasn't released in 1977.

Share this post


Link to post
Share on other sites
You probably want something like $(BUILDFILES) : %.cpp.build : %.cpp instead of .cpp.build: $<

EDIT: GNU Make docs are actually very helpful, in particular, the Static Pattern Usage section is relevant to your question.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!