make

How does make know which files to update

I noticed that when I make changes to some files and then I type make, it will run certain commands related to those files. If I don't change anything, then make doesn't do anything, saying that the program is up to date. This tells me that make has a way of knowing which files were changed since it was last run. How does it know? It...

Using GNU Make on Windows to compile C Code, getting "A subdirectory or file .exe already exists"

Here is the scoop: command I am Invoking: make -d I get this error: Finished prerequisites of target file `stopwatch.obj'. Must remake target `stopwatch.obj'. Creating temporary batch file C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\make35562.sh cl /I .\include /I "c:\Java\jdk150_13\include\win32" /I "c:\Java\jdk150_13\include" /Fo".\buil...

How exactly do I use a makefile?

I'm really confused at the moment. So I have 5 files: main.c, flight.c, flight.h, passenger.c, and passenger.h flight.h has function prototypes for flight.c, and passenger.h has function prototypes for passenger.c flight.c and passenger.c have definitions for these functions. main.c is the program I'll interact with, calling function...

Is there a tool to automatically convert a make file to sln/vcproj?

Google reveals many tools for taking Visual Studio format sln/vcproj files, and producing a make file from them. But I can't find one that solves the opposite problem - I have a make file that references hundreds of .c and .h files and (for convenience, for debugging, for writing code in the VS IDE) would like to open it as a Visual Stud...

how can this src vs. build tree timestamp comparison be faster? (bash)

for n in `cd src; find . -name "*.java"; cd -`; do a=`echo $n | cut -d '.' -f2`; if [[ src/$a.java -nt build/$a.class ]]; then echo src/$a.java; fi; done It lists all the java files in the src tree; then for each one, it removes the suffix ".java" (cut -d '.' -f2 because find . output is prefixed with .). It then uses -nt to ...

Conditional compilation

How do I add conditional compilation to my makefile: say if I have a #ifdef SAVE_DATA in a cpp (.cc) file. ...

Converting a non-GUI Makefile (make) project to KDevelop

I have a rather simple C project I compile with make that I would like to run and debug in KDevelop, but I can't get this to work. I have installed cmake and tried both to import an existing project and start a new (which insists on creating a main.ccp file), but no matter what I do all the menu options to run the program are greyed out....

Append date and time to an environment variable in linux makefile

Hi In my makefile I want to create an environment variable using the current date and time. Psuedo code: LOG_FILE := $LOG_PATH + $SYSTEM_DATE + $SYSTEM_TIME Any help appreciated - thanks. ...

Firefox 3.6 build error on Windows VS2005 - C compiler cannot create executables

I am trying to build Firefox 3.6 Beta 4 using Visual Studio 2005 on Windows. I downloaded the release source, the latest version of mozilla build, but get the error "C compiler cannot create executables.". I have been able to build all other 3.5 and previous versions without any issues. The problem occurs at the start of the build proce...

Does Solaris have a problem with popen?

Please have a look on this code: #include <unistd.h> #include <stdlib.h> #include <stdio.h> int main() { FILE *process_fp = popen("make -f -", "w"); if (process_fp == NULL) { printf("[ERR] make not found!\n"); } else { char txt[1024] = "all:\n\t@echo Hello World!\n"; fwrite(txt, sizeof(char), strl...

How to conditionalize a makefile based upon grep results?

I'm looking for a way to bail out of a makefile if a certain string is not found when checking the version of a tool. The grep expression I'm looking to match is: dplus -VV | grep 'build date and time: Nov 1 2009 19:31:28' which returns a matching line if the proper version of dplus is installed. How do I work a conditional into my...

How to define compiler flags at compile time using CMake?

add_definitions adds definition that is fixed at time when cmake (not make) is executed. How to define them when make (not cmake) is executed? The value of the definition will be an output of a custom command. ...

makefile with directory tree creation suitable for parallel (-j ) build

My project needs temporary directories which are created during the build using mkdir -p similarly to this: all: dirtree $(OBJFILES) dirtree: @mkdir -p $(BUILD)/temp_directory But this approach cannot be used with the -j switch, because first of the OBJFILES get compiled before the mkdir target is made. Is there a standard way t...

Define make variable at rule execution time

In my GNUmakefile, I would like to have a rule that uses a temporary directory. For example: out.tar: TMP := $(shell mktemp -d) echo hi $(TMP)/hi.txt tar -C $(TMP) cf $@ . rm -rf $(TMP) As written, the above rule creates the temporary directory at the time that the rule is parsed. This means that, even I don'...

debugging a makefile

I have a makefile which has statements like below: TOPICS = dmic SRV_MODE = ifeq "$(SRV_FLAG)" "ON" SRV_MODE = 2 endif vpath d%_srv.h $(CNT_PATH) USER_PRE_TARGETS := $(foreach topic,$(TOPICS),$(topic)_srv.h) dmic_srcs = $(wildcard $(CCWSCA)/dmic/src/*.c) \ $(wildcard $(CCWSCA)/dmic/src/*.ppc) dmic_srv.h: $(dm...

Compiling and running a C++ program from a Java application

Hey, i need to run a cpp propgram from a java application. I have Visual Studio and Eclipse. I have all of the cpp files and also a .mak file which i'm not sure about how it could help me... any help or direction would be welcome! ...

Using make to add m4 preprocessing to an arbitrary language

We have an ActionScript (Flex) project that we build using GNU make. We would like to add an M4 preprocessing step to the build process (e.g., so that we can create an ASSERT() macro that includes file and line numbers). We are having remarkable difficulty. Our current strategy is: Create a directory "src/build" (assuming source code...

make wildcard subdirectory targets

I have a "lib" directory in my applications main directory, which contains an arbitrary number of subdirectories, each having its own Makefile. I would like to have a single Makefile in the main directory, that calls each subdirectory's Makefile. I know this is possible if I manually list the subdirs, but I would like to have it done au...

Makefile, Pattern-Rules and Directories.

I want to write a (gmake) makefile for a compiler that - unlike gcc - puts all output files into a specific directory. Unfortunately this behavior cannot be changed. My sources are in multiple directories. How do I write a pattern-rule that lets me compile the sources. Okay, that's a bit unclear. Here is an example. My sources look may...

Compile programs on multicore or distributed system

Is there any software available in linux which compiles a source code containing large number of files parallely on either multicore or distributed systems. Libraries like gcc or xserver takes very time for compilation on unicore/dual machine and most of the times it is frustrating when you need lot of recompilation. Is there any techniq...