| 1 |
|
| 2 |
|
| 3 |
#-----------------------------------------------------------# |
| 4 |
# # |
| 5 |
# LIBMESH6 # |
| 6 |
# # |
| 7 |
#-----------------------------------------------------------# |
| 8 |
# # |
| 9 |
# Description: multi-system makefile (gmake only) # |
| 10 |
# Author: Loic MARECHAL # |
| 11 |
# Creation date: feb 16 2007 # |
| 12 |
# Last modification: may 17 2013 # |
| 13 |
# # |
| 14 |
#-----------------------------------------------------------# |
| 15 |
|
| 16 |
|
| 17 |
CC = /usr/local/bin/gcc |
| 18 |
CFLAGS = -O3 |
| 19 |
|
| 20 |
|
| 21 |
# Working directories |
| 22 |
|
| 23 |
LIBDIR = $(HOME)/lib/$(ARCHI) |
| 24 |
INCDIR = $(HOME)/include |
| 25 |
SRCSDIR = sources |
| 26 |
OBJSDIR = objects/$(ARCHI) |
| 27 |
ARCHDIR = archives |
| 28 |
DIRS = objects $(LIBDIR) $(OBJSDIR) $(ARCHDIR) $(INCDIR) |
| 29 |
VPATH = $(SRCSDIR) |
| 30 |
|
| 31 |
|
| 32 |
# Files to be compiled |
| 33 |
|
| 34 |
SRCS = $(wildcard $(SRCSDIR)/*.c) |
| 35 |
HDRS = $(wildcard $(SRCSDIR)/*.h) |
| 36 |
OBJS = $(patsubst $(SRCSDIR)%, $(OBJSDIR)%, $(SRCS:.c=.a)) |
| 37 |
|
| 38 |
|
| 39 |
# Definition of the compiling implicit rule |
| 40 |
|
| 41 |
$(OBJSDIR)/%.a : $(SRCSDIR)/%.c |
| 42 |
$(CC) -c $(CFLAGS) -I$(SRCSDIR) $< -o $@ |
| 43 |
|
| 44 |
|
| 45 |
# Install the library |
| 46 |
|
| 47 |
$(LIBDIR)/$(LIB): $(DIRS) $(OBJS) |
| 48 |
cp $(OBJSDIR)/*.a $@ |
| 49 |
cp $(SRCSDIR)/*.h $(INCDIR) |
| 50 |
cp $(SRCSDIR)/*.ins $(INCDIR) |
| 51 |
cp $(SRCSDIR)/*.f90 $(INCDIR) |
| 52 |
|
| 53 |
|
| 54 |
# Objects depends on headers |
| 55 |
|
| 56 |
$(OBJS): $(HDRS) |
| 57 |
|
| 58 |
# Fortran API |
| 59 |
|
| 60 |
fortran: $(SRCSDIR)/api/generate_fortran_api.c |
| 61 |
$(CC) $(CFLAGS) -I$(SRCSDIR) $< -o $(SRCSDIR)/generate_fortran_api -lm |
| 62 |
|
| 63 |
# Build the working directories |
| 64 |
|
| 65 |
$(DIRS): |
| 66 |
@[ -d $@ ] || mkdir $@ |
| 67 |
|
| 68 |
|
| 69 |
# Remove temporary files |
| 70 |
|
| 71 |
clean: |
| 72 |
rm -f $(OBJS) |
| 73 |
|
| 74 |
# Build a dated archive including sources, patterns and makefile |
| 75 |
|
| 76 |
tar: $(DIRS) |
| 77 |
tar czf $(ARCHDIR)/libmesh6.`date +"%Y.%m.%d"`.tgz sources tests Makefile |
| 78 |
|
| 79 |
zip: $(DIRS) |
| 80 |
archive_lm6.sh |