-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
54 lines (43 loc) · 1.12 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
# Projet
.PHONY: all dist docs clean
# flags
CC = gcc
CFLAGS += -g -Wall
CPPFLAGS += -Iinclude -I/usr/include/cairo
LDFLAGS += -lcairo -lm -lX11
# executable
BIN_DIR = bin
TARGET = $(BIN_DIR)/main
# chemins
vpath %.c src/
vpath %.h include/
# .o
OBJ_DIR = obj/
OBJ = $(patsubst ./src/%.c,%.o,$(wildcard ./src/*.c))
# librairie
LIB_DIR = lib
LIB = $(LIB_DIR)/libjeu.a
# Gestion du mode
MODE = GRAPHIQUE# Graphique par défaut
# Définit l'expression GRAPHIQUE ou TEXTE selon la valeur de la variable
MODEFLAGS = -D$(MODE)
all: $(TARGET)
$(LIB): $(OBJ_DIR)jeu.o $(OBJ_DIR)grille.o
mkdir -p $(LIB_DIR)
ar rcv $(LIB) $^
ranlib $(LIB)
$(TARGET): $(OBJ_DIR)main.o $(OBJ_DIR)io.o $(LIB)
mkdir -p $(BIN_DIR)
$(CC) $(MODEFLAGS) $(CPPFLAGS) $(CFLAGS) -o $@ $^ -ljeu -L$(LIB_DIR) $(LDFLAGS)
@echo "\nUsage: ./bin/main grilles/grille<num>.txt\n"
$(OBJ_DIR)%.o: %.c | $(OBJ_DIR)
$(CC) $(MODEFLAGS) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
$(OBJ_DIR):
mkdir -p $@
dist:
mkdir -p $@
tar -Jcvf dist/GoL-5.1.tar.xz Doxyfile makefile src/ include/ grilles/
docs:
@doxygen ./Doxyfile
clean:
$(RM) -r doc/ dist/ $(OBJ_DIR) $(BIN_DIR)/ $(LIB_DIR)/