| 1 |
|
| 2 |
|
| 3 |
#-----------------------------------------------------------# |
| 4 |
# # |
| 5 |
# LIBMESH4 # |
| 6 |
# # |
| 7 |
#-----------------------------------------------------------# |
| 8 |
# # |
| 9 |
# Description: multi-system makefile (gmake only) # |
| 10 |
# Author: Loic MARECHAL # |
| 11 |
# Creation date: feb 11 2005 # |
| 12 |
# Last modification: feb 18 2005 # |
| 13 |
# # |
| 14 |
#-----------------------------------------------------------# |
| 15 |
|
| 16 |
|
| 17 |
# Choose of the compiler depending on the architecture |
| 18 |
|
| 19 |
ifeq ($(ARCHI), ppc) |
| 20 |
CC = xlc |
| 21 |
endif |
| 22 |
|
| 23 |
ifeq ($(ARCHI), sparc) |
| 24 |
CC = acc |
| 25 |
endif |
| 26 |
|
| 27 |
ifeq ($(ARCHI), hppa) |
| 28 |
CC = c89 |
| 29 |
endif |
| 30 |
|
| 31 |
ifeq ($(ARCHI), ia64) |
| 32 |
CC = c89 |
| 33 |
endif |
| 34 |
|
| 35 |
ifeq ($(ARCHI), i86) |
| 36 |
CC = iccbin |
| 37 |
endif |
| 38 |
|
| 39 |
ifeq ($(ARCHI), mips) |
| 40 |
CC = c89 |
| 41 |
endif |
| 42 |
|
| 43 |
|
| 44 |
# Working directories |
| 45 |
|
| 46 |
LIBDIR = $(HOME)/lib/$(ARCHI) |
| 47 |
INCDIR = $(HOME)/include |
| 48 |
SRCSDIR = sources |
| 49 |
OBJSDIR = objects/$(ARCHI) |
| 50 |
ARCHDIR = archives |
| 51 |
DIRS = objects $(LIBDIR) $(OBJSDIR) $(ARCHDIR) $(INCDIR) |
| 52 |
VPATH = $(SRCSDIR) |
| 53 |
|
| 54 |
|
| 55 |
# Files to be compiled |
| 56 |
|
| 57 |
SRCS = $(wildcard $(SRCSDIR)/*.c) |
| 58 |
HDRS = $(wildcard $(SRCSDIR)/*.h) |
| 59 |
OBJS = $(patsubst $(SRCSDIR)%, $(OBJSDIR)%, $(SRCS:.c=.o)) |
| 60 |
LIB = libmesh4.a |
| 61 |
|
| 62 |
|
| 63 |
# Definition of the compiling implicit rule |
| 64 |
|
| 65 |
$(OBJSDIR)/%.o : $(SRCSDIR)/%.c |
| 66 |
$(CC) -c -O -I$(SRCSDIR) $< -o $@ |
| 67 |
|
| 68 |
|
| 69 |
# Install the library |
| 70 |
|
| 71 |
$(LIBDIR)/$(LIB): $(DIRS) $(OBJS) |
| 72 |
cp $(OBJSDIR)/libmesh4.o $@ |
| 73 |
cp $(SRCSDIR)/*.h $(INCDIR) |
| 74 |
|
| 75 |
|
| 76 |
# Objects depends on headers |
| 77 |
|
| 78 |
$(OBJS): $(HDRS) |
| 79 |
|
| 80 |
|
| 81 |
# Build the working directories |
| 82 |
|
| 83 |
$(DIRS): |
| 84 |
@[ -d $@ ] || mkdir $@ |
| 85 |
|
| 86 |
|
| 87 |
# Remove temporary files |
| 88 |
|
| 89 |
clean: |
| 90 |
rm -f $(OBJS) $(LIBDIR)/$(LIB) |
| 91 |
|
| 92 |
# Build a dated archive including sources, patterns and makefile |
| 93 |
|
| 94 |
tar: $(DIRS) |
| 95 |
tar czf $(ARCHDIR)/libmesh4.`date +"%Y.%m.%d"`.tgz sources docs tests Makefile |