-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
52 lines (40 loc) · 1.66 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
CC = gcc
LD = g++
# NVCC COMPILER OPTIONS:
NVCC = nvcc
NVCC_FLAGS=-Iinclude -O2
NVCC_LIBS=
# -O0 désactive les optimisations à la compilation
# C'est utile pour débugger, par contre en "production"
# on active au moins les optimisations de niveau 2 (-O2).
CFLAGS = -Wall -Wextra -std=c99 -Iinclude -O2
LDFLAGS = -lm -L /usr/local/cuda/lib64 -lcudart -O2
# Par défaut, on compile tous les fichiers source (.c) qui se trouvent dans le
# répertoire src/
SRC_FILES=$(wildcard src/*.c)
CUDA_SRC_FILES=$(wildcard src/*.cu)
# Par défaut, la compilation de src/toto.c génère le fichier objet obj/toto.o
OBJ_FILES=$(patsubst src/%.c,obj/%.o,$(SRC_FILES))
CUDA_OBJ_FILES = $(patsubst src/%.cu,obj/%.o,$(CUDA_SRC_FILES))
# Fichiers objet "prof". Lorsque vous aurez implémenté un de ces modules, il
# faudra le retirer de cette liste pour lier ppm2jpeg à votre implémentation du
# module en question. Le module htables_prof.o, qui contient la déclaration des tables
# de Huffman génériques sous forme de constantes, n'est pas à ré-implémenter.
OBJ_PROF_FILES = obj_prof/htables_prof.o \
obj_prof/bitstream_prof.o
all: ppm2jpeg
ppm2jpeg: $(OBJ_FILES) $(OBJ_PROF_FILES) $(CUDA_OBJ_FILES)
$(LD) $(OBJ_FILES) $(OBJ_PROF_FILES) $(CUDA_OBJ_FILES) $(LDFLAGS) -o $@
# Compile C source files to object files:
obj/%.o: src/%.c
$(CC) -c $(CFLAGS) $< -o $@
# Compile CUDA source files to object files:
obj/%.o : src/%.cu
$(NVCC) $(NVCC_FLAGS) -c $< -o $@ $(NVCC_LIBS)
# Ajout de la règle pour la compilation en mode debug avec -pg
debug: CFLAGS += -g -pg
debug: LDFLAGS += -pg
debug: clean ppm2jpeg
.PHONY: clean
clean:
rm -rf ppm2jpeg $(OBJ_FILES) $(CUDA_OBJ_FILES) gmon.out