| 1 |
|
| 2 |
|
| 3 |
#-----------------------------------------------------------# |
| 4 |
# # |
| 5 |
# LIBMESH7 # |
| 6 |
# # |
| 7 |
#-----------------------------------------------------------# |
| 8 |
# # |
| 9 |
# Description: multi-system makefile (gmake only) # |
| 10 |
# Author: Loic MARECHAL # |
| 11 |
# Creation date: dec 08 2015 # |
| 12 |
# Last modification: dec 08 2015 # |
| 13 |
# # |
| 14 |
#-----------------------------------------------------------# |
| 15 |
|
| 16 |
|
| 17 |
CC = /usr/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 |
|
| 52 |
|
| 53 |
# Objects depends on headers |
| 54 |
|
| 55 |
$(OBJS): $(HDRS) |
| 56 |
|
| 57 |
# Build the working directories |
| 58 |
|
| 59 |
$(DIRS): |
| 60 |
@[ -d $@ ] || mkdir $@ |
| 61 |
|
| 62 |
|
| 63 |
# Remove temporary files |
| 64 |
|
| 65 |
clean: |
| 66 |
rm -f $(OBJS) |
| 67 |
|
| 68 |
# Build a dated archive including sources, patterns and makefile |
| 69 |
|
| 70 |
tar: $(DIRS) |
| 71 |
tar czf $(ARCHDIR)/libmesh7.`date +"%Y.%m.%d"`.tgz sources tests Makefile |
| 72 |
|
| 73 |
zip: $(DIRS) |
| 74 |
archive_lm7.sh |