Home | History | Annotate | Line # | Download | only in example
      1 # ################################################################
      2 # Copyright (c) Meta Platforms, Inc. and affiliates.
      3 # All rights reserved.
      4 #
      5 # This source code is licensed under both the BSD-style license (found in the
      6 # LICENSE file in the root directory of this source tree) and the GPLv2 (found
      7 # in the COPYING file in the root directory of this source tree).
      8 # You may select, at your option, one of the above-listed licenses.
      9 # ################################################################
     10 
     11 VOID    := /dev/null
     12 ZSTDDIR  := ../include
     13 LIBDIR  := ../static
     14 DLLDIR  := ../dll
     15 
     16 CFLAGS  ?= -O3   # can select custom flags. For example : CFLAGS="-O2 -g" make
     17 CFLAGS  += -Wall -Wextra -Wundef -Wcast-qual -Wcast-align -Wshadow -Wswitch-enum \
     18            -Wdeclaration-after-statement -Wstrict-prototypes \
     19            -Wpointer-arith -Wstrict-aliasing=1
     20 CFLAGS  += $(MOREFLAGS)
     21 CPPFLAGS:= -I$(ZSTDDIR) -DXXH_NAMESPACE=ZSTD_
     22 FLAGS   := $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
     23 
     24 
     25 # Define *.exe as extension for Windows systems
     26 ifneq (,$(filter Windows%,$(OS)))
     27 EXT =.exe
     28 else
     29 EXT =
     30 endif
     31 
     32 .PHONY: default fullbench-dll fullbench-lib
     33 
     34 
     35 default: all
     36 
     37 all: fullbench-dll fullbench-lib
     38 
     39 
     40 fullbench-lib: fullbench.c datagen.c
     41 	$(CC) $(FLAGS) $^ -o $@$(EXT) $(LIBDIR)/libzstd_static.lib
     42 
     43 fullbench-dll: fullbench.c datagen.c
     44 	$(CC) $(FLAGS) $^ -o $@$(EXT) -DZSTD_DLL_IMPORT=1 $(DLLDIR)/libzstd.dll
     45 
     46 clean:
     47 	@$(RM) fullbench-dll$(EXT) fullbench-lib$(EXT) \
     48 	@echo Cleaning completed
     49