Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

outRider

Makefiles using GNU make

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

I have some specific needs and after reading the documentation either I'm missunderstanding how things work or there's no easy way to do what I need. I have some specific c/cpp modules that need to be compiled as ARM code, and others that need to be compiled as THUMB. I figure I'd have two lists, arm_list = this.o that.o thumb_list = foo.o bar.o then, for the rules $(arm_list):: %.o: %.c $(CC) $(CFLAGS) $(ARMFLAGS) $< $(arm_list):: %.o: %.cpp $(CXX) $(CXXFLAGS) $(ARMFLAGS) $< Repeat for thumb, and repeat for asm sources that are either passed to the compiler to be preprocessed, (.S) or the assembler (.s). As far as I can understand it, this wont work because some .o files exist as .c files, others as .cpp files, so somewhere along the line I get a 'no rule to build target' or whatever the specific message is for this.c when make looks for this.cpp to build this.o from. I've tried %.o: %.c and %.o: %.cpp as the target : Pre-requisite but that just takes all .c and .cpp files in the directory and builds them with one set of flags, and I can't specify arm/thumb. If anybody knows their makefiles very well I'd like to pick your brain. ------------ - outRider - [edited by - outRider on August 18, 2003 9:01:38 PM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Try like this:

arm_list = this.o that.o
thumb_list = foo.o bar.o

arm list:
$(arm_list):: %.o: %.c
$(CC) $(CFLAGS) $(ARMFLAGS) $<

thumb_list:
$(arm_list):: %.o: %.cpp
$(CXX) $(CXXFLAGS) $(THUMBFLAGS) $<


then just type

make arm_list
make thumb_list

Share this post


Link to post
Share on other sites
You could also try

arm_cpp_list = $(patsubst %.cpp, %.o, $(wildcard *.cpp))
arm_c_list = $(patsubst %.c, %.o, $(wildcard *.c))

Share this post


Link to post
Share on other sites

  • 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!