-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (40 loc) · 989 Bytes
/
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
# KnapSack Makefile
#
# Usage :
# make : Build the program and tests
# make tests : Only build the tests
# make knapsack : Only build the program
# make clean : Remove all object files
# make clobber : Remove all object files and programs (tests and program)
# make install : Install knapsack
#
# Configuration
## Compiler
CC=clang
ifdef DEBUG
CFLAGS=-g -msse2 -msse3 -DDEBUG -Wall -std=gnu99
else
CFLAGS=-O3 -msse2 -msse3 -msse4 -Wall -std=gnu99 -Wno-format
endif
LDFLAGS= -lm
## Directories
DOBJ=obj
DSRC=src
TARGET=n-dames
#Targets
all: program
program: $(TARGET)
$(TARGET): $(DOBJ)/main.o $(DOBJ)/bf.o \
$(DOBJ)/bf_dyn.o $(DOBJ)/chessboard.o \
$(DOBJ)/forward_checking.o $(DOBJ)/backtrack.o \
$(DOBJ)/local_search2.o $(DOBJ)/local_search3.o \
$(DOBJ)/wikimethod.o
$(CC) $(CFLAGS) $^ -o $@ $(LDFLAGS)
clean:
rm -f $(DOBJ)/*.o
clobber: clean
rm -f $(TARGET)
## Templates
$(DOBJ)/%.o: $(DSRC)/%.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c $^ -o $@