makefile

Makefile option/rule to handle missing/removed source files

http://stackoverflow.com/questions/239004/need-a-makefile-dependency-rule-that-can-handle-missing-files gives some pointers on how to handle removed source files for generating .o files. I'm using gcc/g++, so adding the -MP option when generating dependencies works great for me, until I get to the link stage with my .a file... What abou...

Makefile to compile both C and Java programs at the same time

I have three programs that need to be compiled at the same time, 2 written in C and 1 in java. I had all three working with the Makefile when they were in C, but then switched one of them to java... is there a way to compile all 3 at once with the same makefile? Here is my current Makefile: CC=gcc JC=javac JFLAGS= -g CFLAGS= -Wall -...

linux/unix and makefiles

In linux make file: I want to run the output program only in case of successful compilation. Is there a way to do this? ...

problem finding a header with a c++ makefile

Hi. I've started working with my first makefile. I'm writing a roguelike in C++ using the libtcod library, and have the following hello world program to test if my environment's up and running: #include "libtcod.hpp" int main() { TCODConsole::initRoot(80, 50, "PartyHack"); TCODConsole::root->printCenter(40, 25, TCOD_BKGND_NON...

How to make this Makefile more concise?

I know there are ways to remove duplicates $(CC) $(CFLAGS) $@ $^ in Makefile. Can you tell me how to make the Makefile below more concise? CC=gcc CFLAGS=-pthread -g -o all: p1 p2 p1: p1.c $(CC) $(CFLAGS) $@ $^ p2: p2.c $(CC) $(CFLAGS) $@ $^ ...

Makefile for ASP.NET Website project?

Correct me if I'm wrong - I understand a C#/.NET application's .csproj project file is effectively its makefile or build file. A Website project does not have a .csproj file (not to be mixed up with Web Application which does). In the case of a Website project, can I create a makefile equivalent, or does it use a build process/instruct...

make: invoke command for multiple targets of multiple files?

Hi, I looking to optimize an existing Makefile. It's used to create multiple plots (using Octave) for every logfile in a given directory using an scriptfile for every plot which takes a logfilename as an argument. In the Moment, I use one single rule for every kind of plot available, with a handwritten call to Octave, giving the specifi...

Hiding the removal of intermediate files using Make

I use intermediate files in my Makefile, however make prints out the rm command that it uses to delete them all afterwards. How do I hide this print statement? ...

Compiling netcat on AIX

I have been trying to compile netcat.c on AIX for some time (using the command make aix), but the compiler gives me some weird feedback such as : "netcat.c", line 117.12: 1506-275 (S) Unexpected text 'int' encountered. when checked the file netcat.c at line 117, I would find the line (second line in code below): #ifdef HAVE_BIND exter...

C undefined reference to `some_foo'

Hello, I have 3 files in my gtk+ app: main.c: #include <gtk/gtk.h> #include <glib/gi18n.h> #include "mainwindow.h" int main(int argc, char** argv) { MainWin* win; GError* err = NULL; int a = 0; a = some_foo(); gtk_main(); return 0; } mainwindo.h #include <gtk/gtk.h> typedef struct _MainWin { Gtk...

How to keep asm output from Linux kernel module build

I'm working on a Linux kernel module for a 2.6.x kernel and I need to view the assembly output, though it's currently being done as a temporary file an deleted afterwords. I'd like to have the assembly output mixed with my C source file so I can easily trace where my problem lies. This is for an ARMv6 core and apparently objdump doesn'...

'object' undeclared <first use in this function>

I am using Winchain to develop on my Windows 7 machine. Here is my code: iPhoneTest.h #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface iPhoneTest : UIApplication { UITextView *textview; UIView *mainView; } @end iPhoneTest.m #import "iPhoneTest.h" #import <UIKit/UIKit.h> #import <Foundation/Foundation.h>...

Makefiles - Compile all .cpp files in src/ to .o's in obj/, then link to binary in /

So, my project directory looks like this: /project Makefile main /src main.cpp foo.cpp foo.h bar.cpp bar.h /obj main.o foo.o bar.o What I would like my makefile to do would be to compile all .cpp files in the /src folder to .o files in the /obj folder, the...

what is cairo required by GTK 2.9 to compile (on Lucid Lynx)?

I have been trying to run configure to prepare the make file for GTK 2,9 on a fresh Linux box (running Ubuntu 10.04 Lucid Lynx). it complained about some dependencies, including: glib-2.0 atk (1.29.2) pango (1.20) cairo (1.6) I managed to find the glib 2.22.0, downloaded the atk but did not compile yet, did not start the pango yet, ...

Makefile issue with compiling a C++ program

I recently got MySQL compiled and working on Cygwin, and got a simple test example from online to verify that it worked. The test example compiled and ran successfully. However, when incorporating MySQL in a hobby project of mine it isn't compiling which I believe is due to how the Makefile is setup, I have no experience with Makefiles ...

How to use make and compile as C99?

I'm trying to compile a linux kernel module using a Makefile: obj-m += main.o all: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules clean: make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean Which gives me: main.c:54: warning: ISO C90 forbids mixed declarations and code I need to switch to C99. After...

F#, Linux and makefiles

I intend to distribute an F# program as both binary and source so the user has the option of recompiling it if desired. On Windows, I understand how to do this: provide .fsproj and .sln files, which both Visual Studio and MSBuild can understand. On Linux, the traditional solution for C programs is a makefile. This depends on gcc being d...

How to auto-create a makefile in the same directory as i create a Latex file?

When I create a .tex file using vim I get a nice template from having autocmd BufNewFile *.tex 0r $HOME/.vim/templates/skeleton.tex in my .vimrc. I also have a makefile-template in my home directory, but this one I have to manually copy to where the .tex file is. In a Linux environment, how can I auto-copy or auto-generate the makefil...

Is it a header file or library? in a makefile

I already know the differences between a header file and a library. However, when I'm writing my makefile, I have some difficulties on deciding if I should put something as a dependency of the file or just at the linking rule. For example: I have 2 simple files: main.c: #include <stdio.h> main(){ printf("this is the sine or 90"); s...

What does CC?= in a Makefile mean?

I have a Makefile for a C program that has the declaration CC?=gcc Changing it to CC?=g++ does NOT make it compile with g++. Changing it to CC=g++ DOES make it use g++. So I wonder what the ?= operator does? My guess is that it looks at a environment variable to decide which compiler to use and if it's not set then use gcc? Any...