-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
52 lines (35 loc) · 872 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
51
52
CC = gcc
CFLAGS = -Wall -Wextra -ansi -pedantic
PBIN = ./bin
PSRC = ./src
PINC = ./include
POBJ = ./object
PLIB = ./lib
OBJECT = $(POBJ)/testMoments.o $(POBJ)/moments.o
#All
.PHONY : all
all : $(PBIN)/testMoments
#Library
.PHONY : library
library : $(PLIB)/libimage.a
$(PLIB)/libimage.a : $(POBJ)/image.o
ar crv $@ $^
#Executable files
$(PBIN)/testMoments : $(POBJ)/testMoments.o $(POBJ)/moments.o library
$(CC) $(OBJECT) $(PLIB)/libimage.a -o $@
#Object files
$(POBJ)/moments.o : $(PSRC)/moments.c $(PINC)/image.h $(PINC)/point.h
$(CC) $< -c $(CFLAGS) -o $@
$(POBJ)/testMoments.o : $(PSRC)/testMoments.c $(PINC)/moments.h
$(CC) $< -c $(CFLAGS) -o $@
$(POBJ)/image.o : $(PSRC)/image.c
$(CC) $< -c $(CFLAGS) -o $@
#Remove
.PHONY : clean
clean :
-rm $(PSRC)/*.o
-rm $(PSRC)/*~
-rm $(POBJ)/*.o
.PHONY : distclean
distclean : clean
-rm $(PBIN)/*