-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·61 lines (41 loc) · 1.07 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
CC = g++
C_FLAGS =
CPP_FLAGS = -I. -Wall --pedantic-errors
OPTIMIZATION_FLAGS = -O3
LD_FLAGS = -L.
MAKE = make
AR = ar
PROGRAM_NAME = codecFuckingFodaCodec
DEFINES = -DPROGRAM_NAME=\"$(PROGRAM_NAME)\"
bin = main
algorithms = \
WaveReader \
WaveWriter \
FUF \
FormatoUltraFodaData \
Huffman \
Differencial \
Transform \
Utils
LIB_CODEC = Codec
LIB = -l$(LIB_CODEC)
all: $(bin)
$(algorithms) : lib$(LIB_CODEC).a
all_bin_lo = $(bin:%=%.lo)
# General rules
$(bin) : % : %.o lib$(LIB_CODEC).a
$(CC) $(DEFINES) $(LD_FLAGS) $(LDFLAGS) $(OPTIMIZATION_FLAGS) $(filter %.o, $^) -o $@ $(LIB)
mv $@ $(PROGRAM_NAME)
%.o : %.cpp
$(CC) $(DEFINES) $(CPP_FLAGS) $(CPPFLAGS) $(C_FLAGS) $(CFLAGS) $(OPTIMIZATION_FLAGS) -c $< -o $@
%.lo : %.cpp
$(CC) $(DEFINES) $(CPP_FLAGS) $(CPPFLAGS) -MM -MT '$(<:.cpp=.o) $@' $< > $@
include $(all_bin_lo)
# Build static library
lib$(LIB_CODEC).a : $(algorithms:%=%.o)
$(AR) rcs $@ $^
# Clean up the mess
.PHONY: clean
clean:
rm -f *.o *.lo *.a $(bin) $(PROGRAM_NAME)
rm -f *~ \#*