-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
60 lines (55 loc) · 2.43 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
#******************************************************************************
#************************ MAKEFILE **********************
#************************ Author: Livio Bisogni **********************
#******************************************************************************
#---------------------------------------------------------
# Target file to be compiled by default
#---------------------------------------------------------
MAIN = main
#---------------------------------------------------------
# Source files to be compiled when necessary
#---------------------------------------------------------
SRC = init tank sensor user graphics
#---------------------------------------------------------
# CC is the compiler to be used
#---------------------------------------------------------
CC = gcc
#---------------------------------------------------------
# Directories of files
#---------------------------------------------------------
ODIR = ./obj
SDIR = ./src
HDIR = ./headers
LDIR = ./lib
#---------------------------------------------------------
# CFLAGS are the options passed to the compiler
#---------------------------------------------------------
CFLAGS = -Wall -I$(HDIR) -L$(LDIR)
#---------------------------------------------------------
# OBJS are the object files to be linked
#---------------------------------------------------------
OBJS = $(patsubst %, $(ODIR)/%, $(addsuffix .o, $(MAIN) $(SRC)))
#---------------------------------------------------------
# LIBS are the external libraries to be used
#---------------------------------------------------------
LIBS = -libeasypthread -lpthread -lrt -lm `allegro-config --libs`
#---------------------------------------------------------
# Dependencies
#---------------------------------------------------------
$(MAIN): $(OBJS)
$(CC) $(CFLAGS) -o $(MAIN) $(OBJS) $(LIBS)
$(ODIR)/$(MAIN).o: $(MAIN).c
$(CC) -c $(CFLAGS) -o $@ $< $(LIBS)
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) -c $(CFLAGS) -o $@ $< $(LIBS)
#---------------------------------------------------------
# Command that can be specified inline: make all
#---------------------------------------------------------
all: $(MAIN)
#---------------------------------------------------------
# Command that can be specified inline: make clean
#---------------------------------------------------------
.PHONY: clean
clean:
rm -rf $(ODIR)/* *.o $(MAIN)
#---------------------------------------------------------