makefile

Header Files in Multiple Directories: Best Practices

I'm a C Newb I write lots of code in dynamic languages (javascript, python, haskell, etc.), but I'm now learning C for graduate school and I have no idea what I'm doing. The Problem Originally I was building all my source in one directory using a makefile, which has worked rather well. However, my project is growing and I would like ...

Creating a project, from Makefile to static/dynamic libraries in UNIX

Guys, would you describe a few things about c++ building blocks, on unix. I want to create an application that links against static libs and dynamic libs (.so). Question 1: How do I create static library using gcc/g++ ?How do I make my app link against it. Question 2: How to specify it in the makefile, linking against static and dy...

Adding comments to Makefile

How do I add comments (echo) in a Makefile that should be printed when run? ...

Why some special/control chars in a makefile on *nix at times give errors during make?

I have experienced at times that if any special/control character($,^M, or something else) somehow gets into a makefile, then if u try to make -f Makefile using that makefile it gives errors. I want to know, 1.) Has anyone experienced something like this, and if yes, what causes these errors? What is peculiar about these special char...

C++ development on linux - where do I start?

I decided to leave my windows install behind and am now running Debian as my default OS. I have always coded in Windows and specifically with Visual Studio. I am currently trying to get used to compiling my code under linux. Although I still have a lot of documentation to read, and don't expect you guys to make it too easy for me, it'd ...

How can I build different versions of a project using the Jam make tool?

I have a C++ project that compiles to different versions, including release, debug, shared library, and executable, with different compiler flags for each. I am trying out Jam as an alternative to Make, because it looks like a simpler system. Is Jam capable of this? The main problem is that it always places the .o files into the same f...

How can I set ccshared=-fPIC while executing ./configure?

I am trying to build Python 2.6 for QGIS on RHEL 5. During the making of QGIS I get the following error: Linking CXX shared library libqgispython.so /usr/bin/ld: /usr/local/lib/python2.6/config/libpython2.6.a(abstract.o): relocation R_X86_64_32 against `a local symbol' can not be used when making a shared object; recompile with -fPIC /u...

Makefile for multi-file LaTeX document

I'm trying to simplify/improve the Makefile for compiling my thesis. The Makefile works nicely for compiling the whole thing; I've got something like this: show: thesis.pdf open thesis.pdf thesis.pdf: *.tex pdflatex --shell-escape thesis This allows me to type make and any changes are detected (if any) and it's recompiled bef...

Getting make to delete additional files on error

We're having some discussion lately about the way we handle .d files for dependencies in our make-based build process. The issue has been raised that sometimes the .d files can become corrupted when builds are interrupted. We're using the .DELETE_ON_ERROR target to ensure that if a build is interrupted or fails, the object files that i...

How could I improve this Makefile?

I don't know much about creating Makefiles, but I've been reading the make manual and I have made some progress. My Makefile works and does what I want. My situation usually involves between 1 and 3 different program needed to be compiled and sent to my TA for marking and such via a webform. The structure of each application is 'prog.c'...

Problem Creating a Static Lib in Linux

I am making a simple lib to use in my apps to save me the trouble of defining some functions over and over... Here's my makefile: CC=gcc CFLAGS=-Wall -g -Wextra OBJS=getline.o debug.o LIB=libjimi.a .PHONY: clean purge libjimi.so : $(OBJS) ar rcs $(LIB) $(OBJS) @echo done! %.o : %.c $(CC) $(CFLAGS) -c $^ cl...

Is it possible to create a multi-line string variable in a Makefile

I want to create a makefile variable that is a multi-line string (e.g. the body of an email release announcement). something like ANNOUNCE_BODY=" Version $(VERSION) of $(PACKAGE_NAME) has been released It can be downloaded from $(DOWNLOAD_URL) etc, etc" But I can't seem to find a way to do this. Is it possible? ...

Use sqlite to manage Makefile build flags

I build for more than two dozen targets from a source tree with usually three active branches with both production and debug builds. To date I've used a personal Makefile that defines the target which includes a common Makefile that defines the compile flags which then includes the Makefile from a specific source tree. This works but I...

How do I create a directory in a makefile

I'm using Visual Studio 2005 nmake, and I have a test makefile like this: sometarget: -mkdir c:\testdir I want to always create the directory, without having to specify 'sometarget'. For example, I can do this: !if [if not exist c:\testdir\$(null) mkdir c:\testdir] !endif But that requires two lines, where I really only want to...

Trying to compile and debug C++ from Vim

I've been learning C++ and Allegro using Code::Blocks on Windows XP, and recently felt like learning Vim. However, I have no idea how to compile a program "manually" (i.e., without using an IDE). For compiling from within Vim, I have gotten as far as setting the makeprg to gcc, but I understand I also need a makefile. What is that and h...

In GNU Make, how do I convert a variable to lower case?

This is a silly question, but.... with GNU Make: VAR = MixedCaseText LOWER_VAR = $(VAR,lc) default: @echo $(VAR) @echo $(LOWER_VAR) In the above example, what's the correct syntax for converting VAR's contents to lower case? The syntax shown (and everything else I've run across) result in LOWER_VAR being an empty stri...

Make seems to think a prerequisite is an intermediate file, removes it

For starters, this exercise in GNU make was admittedly just that: an exercise rather than a practicality, since a simple bash script would have sufficed. However, it brought up interesting behavior I don't quite understand. I've written a seemingly simple Makefile to handle generation of SSL key/cert pairs as necessary for MySQL. My goa...

Why is make complaining about circular dependencies?

I have built a make file for my project, and it works (everything compiles) but it gives these irritating error messages: make: Circular zpr.c <- zpr.o dependency dropped. gcc -Wall -c -o zpr.o zpr.c make: Circular readjpeg.c <- readjpeg.o dependency dropped. gcc -Wall -c -o readjpeg.o readjpeg.c make: Circular readppm.c <- readppm....

Issues with I/O in Multi-language compiling

Greeting Everyone I'm trying to compile and run a multi-language code in C, C++ and fortran using gcc, g++ & f77 respectively in UNIX. My program consists of two parts, one in C, the other in C++. They interface via a main() writen in C+, while the fortran code can be ignored for this case. I have been having numerous issues with this,...

Standard F90 Library for Makefile

Greetings Everyone, Trying to compile using g++ and need to link the standard f90 (or f77 even) libraries for some fortran source codes in my Makefile. I cant find the name of it anywhere. Makerfile: products: SlowDynamic.exe SlowDynamic.exe: main.o SA.o mersenne.o CFE.o BCs.o EMatrix.o Numbering.o KMatrix.o Solve.o MA_57.o blas.o MA...