-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
68 lines (50 loc) · 1.39 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
# Generic GNUMakefile
MAKEFILE = gnu
CC = gcc
#debug options
DOPT = -Wall -g
#release options
ROPT = -o3
#opt will get the release/debug config for the compiler
# change to $(DOPT) to produce debugable executable
OPT = $(ROPT)
#release exe name
EXE = mint
#debug exe name
DEXE = mint_d
#add all needed files here! (just C files not header)
SRC = main.c interpreteur.c erreur.c memoire.c
HDR =
#object files for release version
OBJ = $(SRC:.c=.o)
#object files for debug version
DOBJ = $(SRC:.c=_d.o)
INCPATH =
# List of the path to use when looking up for libraries
# modify path to match your target architecture ( x86 or x64), so it will link to the good library
#LIBPATH = -LFreeImage/lib/linux_x86
# list of libraries to be linked
#LIBS = -lSDL -lGL -lfreeimage -lSDL_mixer
# recipes
# ------------
# release rules
all: $(EXE)
$(EXE): $(OBJ)
$(CC) $(ROPT) $(INCPATH) $(LIBPATH) -o $@ $(OBJ) $(LIBS)
%.o : %.c
$(CC) $(ROPT) $(INCPATH) $(LIBPATH) $(LIBS) -c $< -o $@
# ------------
# Debug rule
debug: $(DEXE)
$(DEXE): $(DOBJ)
$(CC) $(DOPT) $(INCPATH) $(LIBPATH) -o $@ $(DOBJ) $(LIBS)
%_d.o : %.c
$(CC) $(DOPT) $(INCPATH) $(LIBPATH) $(LIBS) -c $< -o $@
# -----------
# clean rule
clean:
rm $(OBJ) $(DOBJ)
# memo internal macro
# $@ --> The file name of the target of the rule.
# $^ --> he names of all the prerequisites, with spaces between them.
# $< The name of the first prerequisite.