makefile

Using Makefile instead of Solution/Project files under Visual Studio (2005)

Does anyone have experience using makefiles for Visual Studio C++ builds (under VS 2005) as opposed to using the project/solution setup. For us, the way that the project/solutions work is not intuitive and leads to configuruation explosion when you are trying to tweak builds with specific compile time flags. Under Unix, it's pretty eas...

Simplest way to reverse the order of strings in a make variable

Let's say you have a variable in a makefile fragment like the following: MY_LIST=a b c d How do I then reverse the order of that list? I need: $(warning MY_LIST=${MY_LIST}) to show MY_LIST=d c b a Edit: the real problem is that ld -r some_object.o ${MY_LIST} produces an a.out with undefined symbols because the items in MY_...

Tool for debugging makefiles

I have a large legacy codebase with very complicated makefiles, with lots of variables. Sometimes I need to change them, and I find that it's very difficult to figure out why the change isn't working the way I expect. What I'd like to find is a tool that basically does step-through-debugging of the "make" process, where I would give it...

How can I efficiently build different versions of a component with one Makefile

I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do. I have what I'll call "bills of materials" in version controlled files in a source repository and I b...

makefiles CFLAGS

In the process of learning tinyos i have discovered that I am totally clueless about makefiles. there are many optional compile time features that can be used by way of declaring preprocessor variables to use them you have to do things like CFLAGS="-DPACKET_LINK" this enables a certain feature. and CFLAGS="-DPACKET_LINK" "-D...

Why does Imake interpret certain words in a Imakefile to numerical values?

I've found it very difficult to find any existing documentation on this. What I'm trying to find out is why Imake would interpret a word such as "unix", "linux" or "i386" to a number 1 in the produced Makefile? I'm sure it is a function of indicating whether or not your on that system or not. I've not been able to find that this is a ...

Pause a DOS Console/GNU Makefile if an error occurs

Part of the install for an App I am responsible compiles some C code libraries. This is done in a DOS console using GNU Make. So, as part of the install, a DOS Console window pops open, you see the make file output wiz by as it compiles and links, when finished the DOS Console window closes and the installer continues. All good, unless...

crti.o file missing

Hey, I'm building a project using a gnu tool chain and everything works fine until I get to linking it, where the linker complains that it is missing/can't find crti.o. This is not one of my object files, it seems to be related to libc but I can't understand why it would need this crti.o, wouldn't it use a library file, e.g. libc.a ?? ...

How can you generate a Makefile from an Xcode project?

I want to generate a Makefile from an existing Xcode project on the Mac. Specifically, an existing iPhone, Objective-C program on the Mac. I found PBToMake, but it looks like it is for Xcode 2.1 and when I tried using it, it did not work for an Xcode 3.1 project. ...

gcc dependency generation for a different output directory

I'm using gcc to generate a dependency file but my build rules put the output into a subdirectory. Is there a way to tell gcc to put my subdirectory prefix in the dependency file it generates for me? gcc $(INCLUDES) -E -MM $(CFLAGS) $(SRC) >>$(DEP) ...

how to check if a directory exists in a makefile

I need to generate a directory in my makefile and I would like to not get the "directory already exists error" over and over even though I can easily ignore it. I mainly use mingw/msys but would like something that works across other shells/systems too. I tried this but it didn't work, any ideas? ifeq (,$(findstring $(OBJDIR),$(wildc...

Any clever way to launch a makefile in Visual Studio only if build succeeded?

We have a makefile that is built last in our build process using Visual Studio to launch our unit tests. Unfortunately if the build fails the makefile is still processed and we have extra (annoying) errors. Any way to prevent that? Example Project A : build dummy.exe Project B (makefile) : build command is : run dummy.exe /unittest We ...

makefiles - compile all c files at once

I want to experiment with GCC whole program optimizations. To do so I have to pass all C-files at once to the compiler frontend. However, I use makefiles to automate my build process, and I'm not an expert when it comes to makefile magic. How should I modify the makefile if I want to compile (maybe even link) using just one call to GCC?...

Modern equivalent of javadeps?

I am looking for a replacement for javadeps, which I used to use to generate sections of a Makefile to specify which classes depended on which source files. Unfortunately javadeps itself has not been updated in a while, and cannot parse generic types or static imports. The closest thing I've found so far is Dependency Finder. It almos...

Makefile If-Then Else and Loops

Can someone explain how to use if-then statements and for loops in Makefiles? I can't seem to find any good documentation with examples. ...

Good way to do a "switch" in a Makefile

I'm experimenting with an updated build system at work; currently, I'm trying to find a good way to set compiler & flags depending on the target platform. What I would like to do is something like switch $(PLATFORM)_$(BUILD_TYPE) case "Linux_x86_release" CFLAGS = -O3 case "Linux_x86_debug" CFLAGS = -O0 -g case "ARM_rel...

Make: $(wildcard) holding a directory open

So there seems to be this problem with GNU Make's $(wildcard) function keeping a directory open on Windows. See (unasnwered) post "make is holding a directory open". Google does not provide much information on the topic. In short: the Makefile uses the $(wildcard) function at some point, and keeps a directory open, which typically preve...

GCC with Visual Studio?

How hard would it be to use GCC instead of VC++ from within Visual Studio 2008? Obviously, some of the keywords won't match, and some may not get syntax highlighting (unless you made a new language service). Is this what a 'makefile project' is for, pretty much? ...

No rule to make target consoleio.c

In a recent issue, I've found that DJGPP can only accept the DOS command line character limit. To work around this limitation, I've decided to try to write a makefile to allow me to pass longer strings. In the process of hacking together a makefile and testing it, I've come across a strange error. The makefile is as follows: AS := n...

Resources for learning GNUMake?

Hi all, I'm trying to learn GNUMake for a small project I'm working on. So far, even the "basic" tutorials seem pretty rough and I've yet to make sense of the makefile syntax. Does anyone have some good resources for an absolute beginner to get familiar with GNUMake? ...