Skip to content

Instantly share code, notes, and snippets.

@redacted
Created May 5, 2011 17:28
Show Gist options
  • Save redacted/957467 to your computer and use it in GitHub Desktop.
Save redacted/957467 to your computer and use it in GitHub Desktop.
One Make to rule them all...
# get platform
uname_ans=$(shell uname)
ifeq ($(uname_ans), Darwin)
# on a Mac, can use clang/llvm
# much better diagnostics, slightly slower code
cc=clang
else
# fall back to gcc
cc=gcc
endif
cflags=-Os
ldflags=-lm
sources= main.c anneal.c point_gen.c map_func.c
objects=$(sources:.c=.o)
executable=anneal
all: $(sources) $(executable)
$(executable): $(objects)
$(cc) $(ldflags) $(objects) -o $@
.c.o:
$(cc) $(cflags) $< -c
$(objects): parameters.h
clean:
rm $(executable) $(objects)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment