Skip to content

Build tools

GNU Autoconf

GNU Autoconf is a tool for producing configure scripts for building, installing and packaging software on computer systems where a Bourne shell is available.

At NERSC one should typically replace ./configure with

./configure CC=cc CXX=CC FC=ftn F77=ftn

in order to use the compiler wrappers.

It is often useful to see what additional options are available:

./configure --help | less

Examples of common options:

  • --enable-mpi
  • --enable-hdf5

GNU Make

Make is a common build automation tool in wide use by Unix like systems. (GNU Make)[] is the most widespread implementation and the default for Mac OS X and is the default for most Linux distributions.

A typical Makefile:

TARGET = test
CC = cc
CFLAGS = -g -Wall -qopenmp

.PHONY: default all clean

default: $(TARGET)
all: default

OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
HEADERS = $(wildcard *.h)

%.o: %.c $(HEADERS)
    $(CC) $(CFLAGS) -c $< -o $@


    $(CC) $(CFLAGS) $(OBJECTS) -Wall $(LIBS) -o $@

    -rm -f *.o
    -rm -f $(TARGET)


MPI codes distributed via make have lines like CC = mpicc. In most cases it is sufficient to change these lines to CC = cc.