3 PRGDIR
= ..
/..
/programs
4 ZSTDCOMMON_FILES
:= $(ZSTDDIR
)/common
/*.c
5 ZSTDCOMP_FILES
:= $(ZSTDDIR
)/compress
/*.c
6 ZSTDDECOMP_FILES
:= $(ZSTDDIR
)/decompress
/*.c
7 ZSTD_FILES
:= $(ZSTDDECOMP_FILES
) $(ZSTDCOMMON_FILES
) $(ZSTDCOMP_FILES
)
9 MULTITHREAD_LDFLAGS
= -pthread
10 DEBUGFLAGS
= -g
-DZSTD_DEBUG
=1
11 CPPFLAGS
+= -I
$(ZSTDDIR
) -I
$(ZSTDDIR
)/common
-I
$(ZSTDDIR
)/compress \
12 -I
$(ZSTDDIR
)/dictBuilder
-I
$(ZSTDDIR
)/deprecated
-I
$(PRGDIR
)
14 CFLAGS
+= -Wall
-Wextra
-Wcast-qual
-Wcast-align
-Wshadow \
15 -Wstrict-aliasing
=1 -Wswitch-enum
-Wdeclaration-after-statement \
16 -Wstrict-prototypes
-Wundef \
17 -Wvla
-Wformat
=2 -Winit-self
-Wfloat-equal
-Wwrite-strings \
19 CFLAGS
+= $(DEBUGFLAGS
)
20 CFLAGS
+= $(MOREFLAGS
)
21 FLAGS
= $(CPPFLAGS
) $(CFLAGS
) $(LDFLAGS
) $(MULTITHREAD_LDFLAGS
)
25 adapt
: $(ZSTD_FILES
) $(PRGDIR
)/util.c
$(PRGDIR
)/timefn.c adapt.c
26 $(CC
) $(FLAGS
) $^
-o
$@
28 adapt-debug
: $(ZSTD_FILES
) $(PRGDIR
)/util.c
$(PRGDIR
)/timefn.c adapt.c
29 $(CC
) $(FLAGS
) -DDEBUG_MODE
=2 $^
-o adapt
31 datagen
: $(PRGDIR
)/datagen.c datagencli.c
32 $(CC
) $(FLAGS
) $^
-o
$@
34 test-adapt-correctness
: datagen adapt
35 @.
/test-correctness.sh
36 @echo
"test correctness complete"
38 test-adapt-performance
: datagen adapt
39 @.
/test-performance.sh
40 @echo
"test performance complete"
43 @
$(RM
) -f adapt datagen
48 @echo
"finished cleaning"
50 #-----------------------------------------------------------------------------
51 # make install is validated only for Linux, macOS, BSD, Hurd and Solaris targets
52 #-----------------------------------------------------------------------------
53 ifneq (,$(filter $(shell uname
),Linux Darwin GNU
/kFreeBSD GNU OpenBSD FreeBSD NetBSD DragonFly SunOS
))
55 ifneq (,$(filter $(shell uname
),SunOS
))
63 BINDIR ?
= $(PREFIX
)/bin
65 INSTALL_PROGRAM ?
= $(INSTALL
) -m
755
68 @echo Installing binaries
69 @
$(INSTALL
) -d
-m
755 $(DESTDIR
)$(BINDIR
)/
70 @
$(INSTALL_PROGRAM
) adapt
$(DESTDIR
)$(BINDIR
)/zstd-adaptive
71 @echo zstd-adaptive installation completed
74 @
$(RM
) $(DESTDIR
)$(BINDIR
)/zstd-adaptive
75 @echo zstd-adaptive programs successfully uninstalled