forked from LoicMarechal/libMeshb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (45 loc) · 1.7 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#-----------------------------------------------------------#
# #
# libMeshb7 #
# #
#-----------------------------------------------------------#
# #
# Description: multi-system makefile (gmake only) #
# Author: Loic MARECHAL #
# Creation date: dec 08 2015 #
# Last modification: may 30 2016 #
# #
#-----------------------------------------------------------#
CC = gcc
CFLAGS = -O3
# Working directories
LIBDIR = $(HOME)/lib/$(ARCHI)
INCDIR = $(HOME)/include
SRCSDIR = sources
OBJSDIR = objects/$(ARCHI)
ARCHDIR = archives
DIRS = objects $(LIBDIR) $(OBJSDIR) $(ARCHDIR) $(INCDIR)
VPATH = $(SRCSDIR)
# Files to be compiled
SRCS = $(wildcard $(SRCSDIR)/*.c)
HDRS = $(wildcard $(SRCSDIR)/*.h)
OBJS = $(patsubst $(SRCSDIR)%, $(OBJSDIR)%, $(SRCS:.c=.a))
# Definition of the compiling implicit rule
$(OBJSDIR)/%.a : $(SRCSDIR)/%.c
$(CC) -c $(CFLAGS) -I$(SRCSDIR) $< -o $@
# Install the library
$(LIBDIR)/$(LIB): $(DIRS) $(OBJS)
cp $(OBJSDIR)/*.a $@
cp $(SRCSDIR)/*.h $(INCDIR)
cp $(SRCSDIR)/*.ins $(INCDIR)
# Objects depends on headers
$(OBJS): $(HDRS)
# Build the working directories
$(DIRS):
@[ -d $@ ] || mkdir $@
# Remove temporary files
clean:
rm -f $(OBJS)
# Build a dated archive including sources, patterns and makefile
tar: $(DIRS)
tar czf $(ARCHDIR)/libmeshb7.`date +"%Y.%m.%d"`.tgz sources tests Makefile