From cdd8bf64669f1c674e5a27ffe037d6fd3a0b27f2 Mon Sep 17 00:00:00 2001 From: Martin Rehfeld Date: Sun, 8 Apr 2012 15:08:35 +0200 Subject: [PATCH] add example Makefile --- README.md | 3 ++- examples/Makefile | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 examples/Makefile diff --git a/README.md b/README.md index 48d38f6..8064dc5 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,5 @@ Example usage: f2c myapp.f gcc -o myapp myapp.c -lf2c -The buildpack will detect your app as FORTRAN-77 if it has the file `Makefile` in the root. It will then run `make` to compile the app. +The buildpack will detect your app as FORTRAN-77 if it has the file `Makefile` in the root. +It will then run `make` to compile the app (see examples/Makefile for a template). diff --git a/examples/Makefile b/examples/Makefile new file mode 100644 index 0000000..1245a2d --- /dev/null +++ b/examples/Makefile @@ -0,0 +1,19 @@ +CFLAGS=-c +LDFLAGS=-L$(F2CLIB_DIR) -lf2c -lm + +EXECUTABLE=myapp +SOURCES=myapp.f +OBJECTS=$(SOURCES:.f=.o) +INTERMEDIATES=$(SOURCES:.f=.c) + +all: $(SOURCES) $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(CC) $(OBJECTS) -o $@ $(LDFLAGS) + +.f.o: + f2c $< + $(CC) $(CFLAGS) $(<:.f=.c) -o $@ + +clean: + rm -f $(EXECUTABLE) $(OBJECTS) $(INTERMEDIATES)