1
- include generic.mk
1
+ BIN? =bin
2
2
3
3
CXXFLAGS+=-std =c++14
4
4
CXXFLAGS+ =-Wall -Wextra -Werror
5
5
6
- CXXFLAGS+ =-Isrc/utils -I$(BIN )
6
+ # Reduce executable size
7
+ CXXFLAGS+=-fvisibility =hidden -fvisibility-inlines-hidden
8
+ CXXFLAGS+ =-ffunction-sections -fdata-sections
9
+ LDFLAGS+ =-Wl,-gc-sections
7
10
8
11
ifeq ($(DEBUG ) ,1)
9
12
CXXFLAGS+ =-g3
10
13
LDFLAGS+ =-g
11
14
else
12
- CXXFLAGS+ =-Os
15
+ CFLAGS+ =-w -DNDEBUG
16
+ LDFLAGS+ =-Xlinker -s
17
+ CXXFLAGS+ =-O3
13
18
endif
14
19
15
- # Reduce executable size
16
- CXXFLAGS+ =-ffunction-sections -fdata-sections
17
- LDFLAGS+ =-Wl,-gc-sections
20
+ CXXFLAGS+ =-Isrc/utils -I $( BIN )
21
+
22
+ all : everything
18
23
19
24
# ------------------------------------------------------------------------------
20
25
version :
@@ -39,24 +44,34 @@ SRCS_CW+=\
39
44
src/utils/spec_utils.cpp\
40
45
41
46
SRCS_CW+ =src/specs/av1_hdr10plus/av1_hdr10plus.cpp
42
- SRCS_CW+ =src/specs/avif/avif.cpp
43
- SRCS_CW+ =src/specs/avif/profiles.cpp
44
- SRCS_CW+ =src/specs/avif/utils.cpp
47
+ SRCS_CW+ =src/specs/avif/avif.cpp src/specs/avif/profiles.cpp src/specs/avif/utils.cpp
45
48
SRCS_CW+ =src/specs/isobmff/isobmff.cpp
46
49
SRCS_CW+ =src/specs/heif/heif.cpp
47
- SRCS_CW+ =src/specs/miaf/miaf.cpp
48
- SRCS_CW+ =src/specs/miaf/audio.cpp
49
- SRCS_CW+ =src/specs/miaf/brands.cpp
50
- SRCS_CW+ =src/specs/miaf/derivations.cpp
51
- SRCS_CW+ =src/specs/miaf/colours.cpp
52
- SRCS_CW+ =src/specs/miaf/num_pixels.cpp
53
- SRCS_CW+ =src/specs/miaf/profiles.cpp
50
+ SRCS_CW+ =src/specs/miaf/miaf.cpp src/specs/miaf/audio.cpp src/specs/miaf/brands.cpp\
51
+ src/specs/miaf/derivations.cpp src/specs/miaf/colours.cpp src/specs/miaf/num_pixels.cpp\
52
+ src/specs/miaf/profiles.cpp
54
53
55
54
SRCS_CW+ =$(BIN ) /cw_version.cpp
56
55
56
+ # ------------------------------------------------------------------------------
57
+
57
58
TARGETS+ =$(BIN ) /cw.exe
58
- $(BIN ) /cw.exe : $(SRCS_CW:%=$(BIN ) /%.o )
59
59
60
- # ------------------------------------------------------------------------------
61
60
everything : version $(TARGETS )
62
61
62
+ $(BIN ) /cw.exe : $(SRCS_CW:%=$(BIN ) /%.o )
63
+
64
+ $(BIN ) /% .exe :
65
+ @mkdir -p $(dir $@ )
66
+ $(CXX ) -o " $@ " $^ $(LDFLAGS )
67
+
68
+ $(BIN ) /% .cpp.o : % .cpp
69
+ @mkdir -p $(dir $@ )
70
+ $(CXX ) $(CXXFLAGS ) -c -o " $@ " " $<"
71
+ @$(CXX ) $(CXXFLAGS ) -c -o " $@ .deps" " $<" -MP -MM -MT " $@ "
72
+ @$(CXX ) $(CXXFLAGS ) -c " $<" -E | wc -l > " $@ .lines" # keep track of the code mass
73
+
74
+ clean :
75
+ rm -rf $(BIN )
76
+
77
+ -include $(shell test -d $(BIN ) && find $(BIN ) -name "* .deps")
0 commit comments