makefile

What's the name of the Makefile 'match' special variable?

What is the name of the special Makefile variable that contains the match of %, to use in the rule body? As an example, I would like to use it like this: %.o: %.c @echo Matched $MATCH $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ where I put $MATCH there because I can't remember the actual name of that special pa...

C++ linking to libraries with makefile (newbe)

Hi, I'm trying to understand how to use non standard libraries in my C++ projects. I have a few questions. Lets say I want to use POCO library. So I downloaded it and build it using make (static build). Now I have bunch of .o files and .h files. There is a Path.h file and a Path.o file in different directories. Now I want to use this m...

How can I reduce makefile boilerplate when doing out-of-source builds and Java?

I've got a quick and dirty little make file that does out-of-source builds for a relatively small java project: default: bin/classes/EntryPoint.class bin/classes/manifest jar cvfm ./bin/output.jar ./bin/classes/manifest -C ./bin/classes EntryPoint.class bin/classes/EntryPoint.class: ./src/EntryPoint.java bin javac -sourcepath ...

Simple make file question (C)

Hey so I a new to C but a intermediate level programmer in general. I'm looking in to make files and having issues figuring out exactly what they are for, and how to use them. So for example I am currently compiling each of my files in my project individually by typing: gcc -o newoutfilename1.out oldcfilename1.c gcc -o newoutfilename2...

Have my makefile show me compile errors?

exedarken: darken.c gcc -o exedarken darken.c exeimagestats: imagestats.c gcc -o exeimagestats imagestats.c exelighten: lighten.c gcc -o exelighten lighten.c exerotate: rotate.c gcc -o exerotate rotate.c exeflip: flip.c gcc -o exeflip flip.c exematte: matte.c gcc -o exematte matte.c Theres my makefile. Is ...

Makefile: Error1

I have a very simple c programme: int main() { return(1); } and a simple Makefile: all: gcc -ansi -pedantic -o tmp tmp.c ./tmp However, when I type make I get the following error message: $ make gcc -ansi -pedantic -o tmp tmp.c ./tmp make: *** [all] Error 1 What obvious thing am I missing? ...

Using GNU Make to build both debug and release targets at the same time

I'm working on a medium sized project which contains several libraries with interdependence's which I've recently converted over to build using a non-recursive makefile. My next goal is to enable building of both debug and release builds out of the same source tree at the same time (make debug;make release). My first step was to make d...

struggling with c++ IDE's on linux

hi I'm really frustrated, First I have no idea how to code the very complex (make files), so I'm using IDE's that would ease the job for me like (netbeans , eclipse ,Kdevelop .. etc) i almost tried every thing starting with Emacs (i'm very slow on it and I need autocompletion) Netbeans 6.9.1 (crashes , very slow editor,but amazing and...

Sources from subdirectories in Makefile

I have a C++ library built using a Makefile. Until recently, all the sources were in a single directory, and the Makefile did something like this SOURCES = $(wildcard *.cpp) which worked fine. Now I've added some sources that are in a subdirectory, say subdir. I know I can do this SOURCES = $(wildcard *.cpp) $(wildcard subdir/*.cpp) ...

Makefile for java

I am running Eclipse in windows for doing my homeworks. I have to submit a makefile so that my code (singlefile.java) can be compiled. How can I do this. I found this. Can it be tested on windows. EDIT: As per the suggestions, I installed gnu make for windows: My make file is as follows: JFLAGS = -g JC = javac # .SUFFIXES: .java .cla...

Correct way to call some make targets depending on the value of environment variable?

I should create several packages of our application using make(on AIX). Content of packages should be different depending on one environment variable. Somethink like - if environment variable WITH_CPP set to "Y" then c++ part of application should be built and packed to installation package. If environment variable WITH_CPP set to "N" th...

How do you change the PATH used in an external makefile build using XCode?

I currently have a project that I'm building with a makefile. This project includes some additional software (jflex) which is not on one of the default system search paths (it's installed to (/opt/local/bin/). My .profile file adds this directory to my PATH, and so building the project from a terminal window succeeds. However, if I try ...

MakeFile Error for running a cpp file in ssh

CC=g++ CFLAGS=-O0 TARGET=./problem2_cpp OUTFILE=../output/cpp.txt $(TARGET): problem2.o $(CC) $(CFLAGS) -o $(TARGET) problem2.o problem2.o: problem2.cpp $(CC) $(CFLAGS) -c problem2.cpp clean: rm -f *.o $(TARGET) $(OUTFILE) run: $(TARGET) $(TARGET) <$(INFILE) >$(OUTFILE) I am a rather simple makefile to compile,run a cpp, and out...

How to write simplest makefile for perl

I know to simply run perl in linux you do perl program.pl args . How do I make convert that for a makefile? CC=perl CFLAGS=-O0 TARGET=./problem1 OUTFILE=./log.txt $(TARGET): problem1.o $(CC) $(CFLAGS) -o $(TARGET) problem1.o problem1.o: problem1.cpp $(CC) $(CFLAGS) -c problem1.perl clean: rm -f *.o $(TARGET) $(OUTFILE) run...

Makefile that distincts between Windows and Unix-like systems

I would like to have the same Makefile for building on Linux and on Windows. I use the default GNU make on Linux and the mingw32-make (also GNU make) on Windows. I want the Makefile to detect whether it operates on Windows or Linux. For example make clean command on Windows looks like: clean: del $(DESTDIR_TARGET) But on Linu...

which suits linux ? GNU make vs cmake vs codeblocks vs qmake

In front of me some different Technologies and I'm confused between them. GNU make, CMAKE, Qmake, Code::blocks methodology Code::Blocks uses a custom build system, which stores its information in XML-based project files, but can optionally use external makefiles **says WIKI** 1- What's the difference between CMAKE and GNU MAKE ? 2- I...

How to find the line number of an error in a Makefile?

I am running the following command: make -f makefile.gcc And the output is: make: -c: Command not found How can I find out which line is causing the error? The makefile is hundreds of lines long and there's no way of figuring it out otherwise. I tried the -d switch, but that didn't print any useful information. ...

Simple way of converting slashes in a Makefile?

I need to convert all paths with '\' in them to '/'. The makefile is quite long and doing this manually is impossible. Is there some way to quickly convert them? Keep in mind that a global replace is not possible because '\' is also used to denote that a command is continued on the following line. ...

Makefile for Java cannot find package

Hello I am new in Java development. I tried to write a makefile which should be runnable in Linux: JFLAGS = -g JC = javac .SUFFIXES: .java .class .java.class: $(JC) $(JFLAGS) $*.java Heap.class: FibonacciHeap.java \ FileOperation.java \ MinLeftistTree.java \ RandomPermutation.java \ Heap.java default: classes cla...

How to write "set classpath" in makefile for Java in Linux?

Hello, I have a newbie question for writing makefile for java in Linux I have a project with: A.java B.java C.java A is dependent on B.java and C.java, they should be in the same folder It is supposed that when I entered the folder, I can run the make command to generate classes. How can I set the classpath as the current folder of...