Skip to content

Commit

Permalink
add example Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Rehfeld committed Apr 8, 2012
1 parent 47055ec commit cdd8bf6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -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).
19 changes: 19 additions & 0 deletions 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)

0 comments on commit cdd8bf6

Please sign in to comment.