mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-10-30 22:54:07 +00:00 
			
		
		
		
	Changed Makefile syntax test source
Now using Makefile from the Redis project
This commit is contained in:
		
				
					committed by
					
						 David Peter
						David Peter
					
				
			
			
				
	
			
			
			
						parent
						
							57ad85814b
						
					
				
				
					commit
					7c7eebbe83
				
			| @@ -1,195 +1,385 @@ | ||||
| #!/usr/bin/make -f | ||||
| # Generated automatically from Makefile.in by configure. | ||||
| # Un*x Makefile for GNU tar program. | ||||
| # Copyright (C) 1991 Free Software Foundation, Inc. | ||||
| # Redis Makefile | ||||
| # Copyright (C) 2009 Salvatore Sanfilippo <antirez at gmail dot com> | ||||
| # This file is released under the BSD license, see the COPYING file | ||||
| # | ||||
| # The Makefile composes the final FINAL_CFLAGS and FINAL_LDFLAGS using | ||||
| # what is needed for Redis plus the standard CFLAGS and LDFLAGS passed. | ||||
| # However when building the dependencies (Jemalloc, Lua, Hiredis, ...) | ||||
| # CFLAGS and LDFLAGS are propagated to the dependencies, so to pass | ||||
| # flags only to be used when compiling / linking Redis itself REDIS_CFLAGS | ||||
| # and REDIS_LDFLAGS are used instead (this is the case of 'make gcov'). | ||||
| # | ||||
| # Dependencies are stored in the Makefile.dep file. To rebuild this file | ||||
| # Just use 'make dep', but this is only needed by developers. | ||||
|  | ||||
| # This program is free software; you can redistribute | ||||
| # it and/or modify it under the terms of the GNU | ||||
| # General Public License … | ||||
| … | ||||
| … | ||||
| release_hdr := $(shell sh -c './mkreleasehdr.sh') | ||||
| uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') | ||||
| uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') | ||||
| OPTIMIZATION?=-O2 | ||||
| DEPENDENCY_TARGETS=hiredis linenoise lua | ||||
| NODEPS:=clean distclean | ||||
|  | ||||
| SHELL = /bin/sh | ||||
| # Default settings | ||||
| STD=-std=c11 -pedantic -DREDIS_STATIC='' | ||||
| ifneq (,$(findstring clang,$(CC))) | ||||
| ifneq (,$(findstring FreeBSD,$(uname_S))) | ||||
|   STD+=-Wno-c11-extensions | ||||
| endif | ||||
| endif | ||||
| WARN=-Wall -W -Wno-missing-field-initializers | ||||
| OPT=$(OPTIMIZATION) | ||||
|  | ||||
| #### Start of system configuration section. #### | ||||
| PREFIX?=/usr/local | ||||
| INSTALL_BIN=$(PREFIX)/bin | ||||
| INSTALL=install | ||||
| PKG_CONFIG?=pkg-config | ||||
|  | ||||
| srcdir = . | ||||
| # Default allocator defaults to Jemalloc if it's not an ARM | ||||
| MALLOC=libc | ||||
| ifneq ($(uname_M),armv6l) | ||||
| ifneq ($(uname_M),armv7l) | ||||
| ifeq ($(uname_S),Linux) | ||||
| 	MALLOC=jemalloc | ||||
| endif | ||||
| endif | ||||
| endif | ||||
|  | ||||
| # If you use gcc, you should either run the | ||||
| # fixincludes script that comes with it or else use | ||||
| # gcc with the -traditional option.  Otherwise ioctl | ||||
| # calls will be compiled incorrectly on some systems. | ||||
| CC = gcc -O | ||||
| YACC = bison -y | ||||
| INSTALL = /usr/local/bin/install -c | ||||
| INSTALLDATA = /usr/local/bin/install -c -m 644 | ||||
| # To get ARM stack traces if Redis crashes we need a special C flag. | ||||
| ifneq (,$(filter aarch64 armv,$(uname_M))) | ||||
|         CFLAGS+=-funwind-tables | ||||
| else | ||||
| ifneq (,$(findstring armv,$(uname_M))) | ||||
|         CFLAGS+=-funwind-tables | ||||
| endif | ||||
| endif | ||||
|  | ||||
| # Things you might add to DEFS: | ||||
| # -DSTDC_HEADERS        If you have ANSI C headers and | ||||
| #                       libraries. | ||||
| # -DPOSIX               If you have POSIX.1 headers and | ||||
| #                       libraries. | ||||
| # -DBSD42               If you have sys/dir.h (unless | ||||
| #                       you use -DPOSIX), sys/file.h, | ||||
| #                       and st_blocks in `struct stat'. | ||||
| # -DUSG                 If you have System V/ANSI C | ||||
| #                       string and memory functions | ||||
| #                       and headers, sys/sysmacros.h, | ||||
| #                       fcntl.h, getcwd, no valloc, | ||||
| #                       and ndir.h (unless | ||||
| #                       you use -DDIRENT). | ||||
| # -DNO_MEMORY_H         If USG or STDC_HEADERS but do not | ||||
| #                       include memory.h. | ||||
| # -DDIRENT              If USG and you have dirent.h | ||||
| #                       instead of ndir.h. | ||||
| # -DSIGTYPE=int         If your signal handlers | ||||
| #                       return int, not void. | ||||
| # -DNO_MTIO             If you lack sys/mtio.h | ||||
| #                       (magtape ioctls). | ||||
| # -DNO_REMOTE           If you do not have a remote shell | ||||
| #                       or rexec. | ||||
| # -DUSE_REXEC           To use rexec for remote tape | ||||
| #                       operations instead of | ||||
| #                       forking rsh or remsh. | ||||
| # -DVPRINTF_MISSING     If you lack vprintf function | ||||
| #                       (but have _doprnt). | ||||
| # -DDOPRNT_MISSING      If you lack _doprnt function. | ||||
| #                       Also need to define | ||||
| #                       -DVPRINTF_MISSING. | ||||
| # -DFTIME_MISSING       If you lack ftime system call. | ||||
| # -DSTRSTR_MISSING      If you lack strstr function. | ||||
| # -DVALLOC_MISSING      If you lack valloc function. | ||||
| # -DMKDIR_MISSING       If you lack mkdir and | ||||
| #                       rmdir system calls. | ||||
| # -DRENAME_MISSING      If you lack rename system call. | ||||
| # -DFTRUNCATE_MISSING   If you lack ftruncate | ||||
| #                       system call. | ||||
| # -DV7                  On Version 7 Unix (not | ||||
| #                       tested in a long time). | ||||
| # -DEMUL_OPEN3          If you lack a 3-argument version | ||||
| #                       of open, and want to emulate it | ||||
| #                       with system calls you do have. | ||||
| # -DNO_OPEN3            If you lack the 3-argument open | ||||
| #                       and want to disable the tar -k | ||||
| #                       option instead of emulating open. | ||||
| # -DXENIX               If you have sys/inode.h | ||||
| #                       and need it 94 to be included. | ||||
| # Backwards compatibility for selecting an allocator | ||||
| ifeq ($(USE_TCMALLOC),yes) | ||||
| 	MALLOC=tcmalloc | ||||
| endif | ||||
|  | ||||
| DEFS =  -DSIGTYPE=int -DDIRENT -DSTRSTR_MISSING \ | ||||
|         -DVPRINTF_MISSING -DBSD42 | ||||
| # Set this to rtapelib.o unless you defined NO_REMOTE, | ||||
| # in which case make it empty. | ||||
| RTAPELIB = rtapelib.o | ||||
| LIBS = | ||||
| DEF_AR_FILE = /dev/rmt8 | ||||
| DEFBLOCKING = 20 | ||||
| ifeq ($(USE_TCMALLOC_MINIMAL),yes) | ||||
| 	MALLOC=tcmalloc_minimal | ||||
| endif | ||||
|  | ||||
| CDEBUG = -g | ||||
| CFLAGS = $(CDEBUG) -I. -I$(srcdir) $(DEFS) \ | ||||
|         -DDEF_AR_FILE=\"$(DEF_AR_FILE)\" \ | ||||
|         -DDEFBLOCKING=$(DEFBLOCKING) | ||||
| LDFLAGS = -g | ||||
| ifeq ($(USE_JEMALLOC),yes) | ||||
| 	MALLOC=jemalloc | ||||
| endif | ||||
|  | ||||
| prefix = /usr/local | ||||
| # Prefix for each installed program, | ||||
| # normally empty or `g'. | ||||
| binprefix = | ||||
| ifeq ($(USE_JEMALLOC),no) | ||||
| 	MALLOC=libc | ||||
| endif | ||||
|  | ||||
| # The directory to install tar in. | ||||
| bindir = $(prefix)/bin | ||||
| # Override default settings if possible | ||||
| -include .make-settings | ||||
|  | ||||
| # The directory to install the info files in. | ||||
| infodir = $(prefix)/info | ||||
| FINAL_CFLAGS=$(STD) $(WARN) $(OPT) $(DEBUG) $(CFLAGS) $(REDIS_CFLAGS) | ||||
| FINAL_LDFLAGS=$(LDFLAGS) $(REDIS_LDFLAGS) $(DEBUG) | ||||
| FINAL_LIBS=-lm | ||||
| DEBUG=-g -ggdb | ||||
|  | ||||
| #### End of system configuration section. #### | ||||
| # Linux ARM needs -latomic at linking time | ||||
| ifneq (,$(filter aarch64 armv,$(uname_M))) | ||||
|         FINAL_LIBS+=-latomic | ||||
| else | ||||
| ifneq (,$(findstring armv,$(uname_M))) | ||||
|         FINAL_LIBS+=-latomic | ||||
| endif | ||||
| endif | ||||
|  | ||||
| SRCS_C  = tar.c create.c extract.c buffer.c   \ | ||||
|           getoldopt.c update.c gnu.c mangle.c \ | ||||
|           version.c list.c names.c diffarch.c \ | ||||
|           port.c wildmat.c getopt.c getopt1.c \ | ||||
|           regex.c | ||||
| SRCS_Y  = getdate.y | ||||
| SRCS    = $(SRCS_C) $(SRCS_Y) | ||||
| OBJS    = $(SRCS_C:.c=.o) $(SRCS_Y:.y=.o) $(RTAPELIB) | ||||
| AUX =   README COPYING ChangeLog Makefile.in  \ | ||||
|         makefile.pc configure configure.in \ | ||||
|         tar.texinfo tar.info* texinfo.tex \ | ||||
|         tar.h port.h open3.h getopt.h regex.h \ | ||||
|         rmt.h rmt.c rtapelib.c alloca.c \ | ||||
|         msd_dir.h msd_dir.c tcexparg.c \ | ||||
|         level-0 level-1 backup-specs testpad.c | ||||
| ifeq ($(uname_S),SunOS) | ||||
| 	# SunOS | ||||
|         ifneq ($(@@),32bit) | ||||
| 		CFLAGS+= -m64 | ||||
| 		LDFLAGS+= -m64 | ||||
| 	endif | ||||
| 	DEBUG=-g | ||||
| 	DEBUG_FLAGS=-g | ||||
| 	export CFLAGS LDFLAGS DEBUG DEBUG_FLAGS | ||||
| 	INSTALL=cp -pf | ||||
| 	FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6 | ||||
| 	FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt | ||||
| else | ||||
| ifeq ($(uname_S),Darwin) | ||||
| 	# Darwin | ||||
| 	FINAL_LIBS+= -ldl | ||||
| 	OPENSSL_CFLAGS=-I/usr/local/opt/openssl/include | ||||
| 	OPENSSL_LDFLAGS=-L/usr/local/opt/openssl/lib | ||||
| else | ||||
| ifeq ($(uname_S),AIX) | ||||
|         # AIX | ||||
|         FINAL_LDFLAGS+= -Wl,-bexpall | ||||
|         FINAL_LIBS+=-ldl -pthread -lcrypt -lbsd | ||||
| else | ||||
| ifeq ($(uname_S),OpenBSD) | ||||
| 	# OpenBSD | ||||
| 	FINAL_LIBS+= -lpthread | ||||
| 	ifeq ($(USE_BACKTRACE),yes) | ||||
| 	    FINAL_CFLAGS+= -DUSE_BACKTRACE -I/usr/local/include | ||||
| 	    FINAL_LDFLAGS+= -L/usr/local/lib | ||||
| 	    FINAL_LIBS+= -lexecinfo | ||||
|     	endif | ||||
|  | ||||
| else | ||||
| ifeq ($(uname_S),FreeBSD) | ||||
| 	# FreeBSD | ||||
| 	FINAL_LIBS+= -lpthread -lexecinfo | ||||
| else | ||||
| ifeq ($(uname_S),DragonFly) | ||||
| 	# FreeBSD | ||||
| 	FINAL_LIBS+= -lpthread -lexecinfo | ||||
| else | ||||
| ifeq ($(uname_S),OpenBSD) | ||||
| 	# OpenBSD | ||||
| 	FINAL_LIBS+= -lpthread -lexecinfo | ||||
| else | ||||
| ifeq ($(uname_S),NetBSD) | ||||
| 	# NetBSD | ||||
| 	FINAL_LIBS+= -lpthread -lexecinfo | ||||
| else | ||||
| 	# All the other OSes (notably Linux) | ||||
| 	FINAL_LDFLAGS+= -rdynamic | ||||
| 	FINAL_LIBS+=-ldl -pthread -lrt | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| endif | ||||
| # Include paths to dependencies | ||||
| FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src | ||||
|  | ||||
| # Determine systemd support and/or build preference (defaulting to auto-detection) | ||||
| BUILD_WITH_SYSTEMD=no | ||||
| # If 'USE_SYSTEMD' in the environment is neither "no" nor "yes", try to | ||||
| # auto-detect libsystemd's presence and link accordingly. | ||||
| ifneq ($(USE_SYSTEMD),no) | ||||
| 	LIBSYSTEMD_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libsystemd && echo $$?) | ||||
| # If libsystemd cannot be detected, continue building without support for it | ||||
| # (unless a later check tells us otherwise) | ||||
| ifeq ($(LIBSYSTEMD_PKGCONFIG),0) | ||||
| 	BUILD_WITH_SYSTEMD=yes | ||||
| endif | ||||
| endif | ||||
| ifeq ($(USE_SYSTEMD),yes) | ||||
| ifneq ($(LIBSYSTEMD_PKGCONFIG),0) | ||||
| $(error USE_SYSTEMD is set to "$(USE_SYSTEMD)", but $(PKG_CONFIG) cannot find libsystemd) | ||||
| endif | ||||
| # Force building with libsystemd | ||||
| 	BUILD_WITH_SYSTEMD=yes | ||||
| endif | ||||
| ifeq ($(BUILD_WITH_SYSTEMD),yes) | ||||
| 	FINAL_LIBS+=$(shell $(PKG_CONFIG) --libs libsystemd) | ||||
| 	FINAL_CFLAGS+= -DHAVE_LIBSYSTEMD | ||||
| endif | ||||
|  | ||||
| ifeq ($(MALLOC),tcmalloc) | ||||
| 	FINAL_CFLAGS+= -DUSE_TCMALLOC | ||||
| 	FINAL_LIBS+= -ltcmalloc | ||||
| endif | ||||
|  | ||||
| ifeq ($(MALLOC),tcmalloc_minimal) | ||||
| 	FINAL_CFLAGS+= -DUSE_TCMALLOC | ||||
| 	FINAL_LIBS+= -ltcmalloc_minimal | ||||
| endif | ||||
|  | ||||
| ifeq ($(MALLOC),jemalloc) | ||||
| 	DEPENDENCY_TARGETS+= jemalloc | ||||
| 	FINAL_CFLAGS+= -DUSE_JEMALLOC -I../deps/jemalloc/include | ||||
| 	FINAL_LIBS := ../deps/jemalloc/lib/libjemalloc.a $(FINAL_LIBS) | ||||
| endif | ||||
|  | ||||
| ifeq ($(BUILD_TLS),yes) | ||||
| 	FINAL_CFLAGS+=-DUSE_OPENSSL $(OPENSSL_CFLAGS) | ||||
| 	FINAL_LDFLAGS+=$(OPENSSL_LDFLAGS) | ||||
| 	LIBSSL_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libssl && echo $$?) | ||||
| ifeq ($(LIBSSL_PKGCONFIG),0) | ||||
| 	LIBSSL_LIBS=$(shell $(PKG_CONFIG) --libs libssl) | ||||
| else | ||||
| 	LIBSSL_LIBS=-lssl | ||||
| endif | ||||
| 	LIBCRYPTO_PKGCONFIG := $(shell $(PKG_CONFIG) --exists libcrypto && echo $$?) | ||||
| ifeq ($(LIBCRYPTO_PKGCONFIG),0) | ||||
| 	LIBCRYPTO_LIBS=$(shell $(PKG_CONFIG) --libs libcrypto) | ||||
| else | ||||
| 	LIBCRYPTO_LIBS=-lcrypto | ||||
| endif | ||||
| 	FINAL_LIBS += ../deps/hiredis/libhiredis_ssl.a $(LIBSSL_LIBS) $(LIBCRYPTO_LIBS) | ||||
| endif | ||||
|  | ||||
| REDIS_CC=$(QUIET_CC)$(CC) $(FINAL_CFLAGS) | ||||
| REDIS_LD=$(QUIET_LINK)$(CC) $(FINAL_LDFLAGS) | ||||
| REDIS_INSTALL=$(QUIET_INSTALL)$(INSTALL) | ||||
|  | ||||
| CCCOLOR="\033[34m" | ||||
| LINKCOLOR="\033[34;1m" | ||||
| SRCCOLOR="\033[33m" | ||||
| BINCOLOR="\033[37;1m" | ||||
| MAKECOLOR="\033[32;1m" | ||||
| ENDCOLOR="\033[0m" | ||||
|  | ||||
| ifndef V | ||||
| QUIET_CC = @printf '    %b %b\n' $(CCCOLOR)CC$(ENDCOLOR) $(SRCCOLOR)$@$(ENDCOLOR) 1>&2; | ||||
| QUIET_LINK = @printf '    %b %b\n' $(LINKCOLOR)LINK$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2; | ||||
| QUIET_INSTALL = @printf '    %b %b\n' $(LINKCOLOR)INSTALL$(ENDCOLOR) $(BINCOLOR)$@$(ENDCOLOR) 1>&2; | ||||
| endif | ||||
|  | ||||
| REDIS_SERVER_NAME=redis-server | ||||
| REDIS_SENTINEL_NAME=redis-sentinel | ||||
| REDIS_SERVER_OBJ=adlist.o quicklist.o ae.o anet.o dict.o server.o sds.o zmalloc.o lzf_c.o lzf_d.o pqsort.o zipmap.o sha1.o ziplist.o release.o networking.o util.o object.o db.o replication.o rdb.o t_string.o t_list.o t_set.o t_zset.o t_hash.o config.o aof.o pubsub.o multi.o debug.o sort.o intset.o syncio.o cluster.o crc16.o endianconv.o slowlog.o scripting.o bio.o rio.o rand.o memtest.o crcspeed.o crc64.o bitops.o sentinel.o notify.o setproctitle.o blocked.o hyperloglog.o latency.o sparkline.o redis-check-rdb.o redis-check-aof.o geo.o lazyfree.o module.o evict.o expire.o geohash.o geohash_helper.o childinfo.o defrag.o siphash.o rax.o t_stream.o listpack.o localtime.o lolwut.o lolwut5.o lolwut6.o acl.o gopher.o tracking.o connection.o tls.o sha256.o timeout.o setcpuaffinity.o | ||||
| REDIS_CLI_NAME=redis-cli | ||||
| REDIS_CLI_OBJ=anet.o adlist.o dict.o redis-cli.o zmalloc.o release.o ae.o crcspeed.o crc64.o siphash.o crc16.o | ||||
| REDIS_BENCHMARK_NAME=redis-benchmark | ||||
| REDIS_BENCHMARK_OBJ=ae.o anet.o redis-benchmark.o adlist.o dict.o zmalloc.o siphash.o | ||||
| REDIS_CHECK_RDB_NAME=redis-check-rdb | ||||
| REDIS_CHECK_AOF_NAME=redis-check-aof | ||||
|  | ||||
| all: $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCHMARK_NAME) $(REDIS_CHECK_RDB_NAME) $(REDIS_CHECK_AOF_NAME) | ||||
| 	@echo "" | ||||
| 	@echo "Hint: It's a good idea to run 'make test' ;)" | ||||
| 	@echo "" | ||||
|  | ||||
| Makefile.dep: | ||||
| 	-$(REDIS_CC) -MM *.c > Makefile.dep 2> /dev/null || true | ||||
|  | ||||
| ifeq (0, $(words $(findstring $(MAKECMDGOALS), $(NODEPS)))) | ||||
| -include Makefile.dep | ||||
| endif | ||||
|  | ||||
| .PHONY: all | ||||
| all:    tar rmt tar.info | ||||
|  | ||||
| tar:    $(OBJS) | ||||
|         $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS) | ||||
| persist-settings: distclean | ||||
| 	echo STD=$(STD) >> .make-settings | ||||
| 	echo WARN=$(WARN) >> .make-settings | ||||
| 	echo OPT=$(OPT) >> .make-settings | ||||
| 	echo MALLOC=$(MALLOC) >> .make-settings | ||||
| 	echo BUILD_TLS=$(BUILD_TLS) >> .make-settings | ||||
| 	echo USE_SYSTEMD=$(USE_SYSTEMD) >> .make-settings | ||||
| 	echo CFLAGS=$(CFLAGS) >> .make-settings | ||||
| 	echo LDFLAGS=$(LDFLAGS) >> .make-settings | ||||
| 	echo REDIS_CFLAGS=$(REDIS_CFLAGS) >> .make-settings | ||||
| 	echo REDIS_LDFLAGS=$(REDIS_LDFLAGS) >> .make-settings | ||||
| 	echo PREV_FINAL_CFLAGS=$(FINAL_CFLAGS) >> .make-settings | ||||
| 	echo PREV_FINAL_LDFLAGS=$(FINAL_LDFLAGS) >> .make-settings | ||||
| 	-(cd ../deps && $(MAKE) $(DEPENDENCY_TARGETS)) | ||||
|  | ||||
| rmt:    rmt.c | ||||
|         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ rmt.c | ||||
| .PHONY: persist-settings | ||||
|  | ||||
| tar.info: tar.texinfo | ||||
|         makeinfo tar.texinfo | ||||
| # Prerequisites target | ||||
| .make-prerequisites: | ||||
| 	@touch $@ | ||||
|  | ||||
| .PHONY: install | ||||
| install: all | ||||
|         $(INSTALL) tar $(bindir)/$(binprefix)tar | ||||
|         -test ! -f rmt || $(INSTALL) rmt /etc/rmt | ||||
|         $(INSTALLDATA) $(srcdir)/tar.info* $(infodir) | ||||
| # Clean everything, persist settings and build dependencies if anything changed | ||||
| ifneq ($(strip $(PREV_FINAL_CFLAGS)), $(strip $(FINAL_CFLAGS))) | ||||
| .make-prerequisites: persist-settings | ||||
| endif | ||||
|  | ||||
| $(OBJS): tar.h port.h testpad.h | ||||
| regex.o buffer.o tar.o: regex.h | ||||
| # getdate.y has 8 shift/reduce conflicts. | ||||
| ifneq ($(strip $(PREV_FINAL_LDFLAGS)), $(strip $(FINAL_LDFLAGS))) | ||||
| .make-prerequisites: persist-settings | ||||
| endif | ||||
|  | ||||
| testpad.h: testpad | ||||
|         ./testpad | ||||
| # redis-server | ||||
| $(REDIS_SERVER_NAME): $(REDIS_SERVER_OBJ) | ||||
| 	$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/lua/src/liblua.a $(FINAL_LIBS) | ||||
|  | ||||
| testpad: testpad.o | ||||
|         $(CC) -o $@ testpad.o | ||||
| # redis-sentinel | ||||
| $(REDIS_SENTINEL_NAME): $(REDIS_SERVER_NAME) | ||||
| 	$(REDIS_INSTALL) $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) | ||||
|  | ||||
| TAGS:   $(SRCS) | ||||
|         etags $(SRCS) | ||||
| # redis-check-rdb | ||||
| $(REDIS_CHECK_RDB_NAME): $(REDIS_SERVER_NAME) | ||||
| 	$(REDIS_INSTALL) $(REDIS_SERVER_NAME) $(REDIS_CHECK_RDB_NAME) | ||||
|  | ||||
| # redis-check-aof | ||||
| $(REDIS_CHECK_AOF_NAME): $(REDIS_SERVER_NAME) | ||||
| 	$(REDIS_INSTALL) $(REDIS_SERVER_NAME) $(REDIS_CHECK_AOF_NAME) | ||||
|  | ||||
| # redis-cli | ||||
| $(REDIS_CLI_NAME): $(REDIS_CLI_OBJ) | ||||
| 	$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a ../deps/linenoise/linenoise.o $(FINAL_LIBS) | ||||
|  | ||||
| # redis-benchmark | ||||
| $(REDIS_BENCHMARK_NAME): $(REDIS_BENCHMARK_OBJ) | ||||
| 	$(REDIS_LD) -o $@ $^ ../deps/hiredis/libhiredis.a $(FINAL_LIBS) | ||||
|  | ||||
| dict-benchmark: dict.c zmalloc.c sds.c siphash.c | ||||
| 	$(REDIS_CC) $(FINAL_CFLAGS) $^ -D DICT_BENCHMARK_MAIN -o $@ $(FINAL_LIBS) | ||||
|  | ||||
| DEP = $(REDIS_SERVER_OBJ:%.o=%.d) $(REDIS_CLI_OBJ:%.o=%.d) $(REDIS_BENCHMARK_OBJ:%.o=%.d) | ||||
| -include $(DEP) | ||||
|  | ||||
| # Because the jemalloc.h header is generated as a part of the jemalloc build, | ||||
| # building it should complete before building any other object. Instead of | ||||
| # depending on a single artifact, build all dependencies first. | ||||
| %.o: %.c .make-prerequisites | ||||
| 	$(REDIS_CC) -MMD -o $@ -c $< | ||||
|  | ||||
| clean: | ||||
| 	rm -rf $(REDIS_SERVER_NAME) $(REDIS_SENTINEL_NAME) $(REDIS_CLI_NAME) $(REDIS_BENCHMARK_NAME) $(REDIS_CHECK_RDB_NAME) $(REDIS_CHECK_AOF_NAME) *.o *.gcda *.gcno *.gcov redis.info lcov-html Makefile.dep dict-benchmark | ||||
| 	rm -f $(DEP) | ||||
|  | ||||
| .PHONY: clean | ||||
| clean: | ||||
|         rm -f *.o tar rmt testpad testpad.h core | ||||
|  | ||||
| distclean: clean | ||||
| 	-(cd ../deps && $(MAKE) distclean) | ||||
| 	-(rm -f .make-*) | ||||
|  | ||||
| .PHONY: distclean | ||||
| distclean: clean | ||||
|         rm -f TAGS Makefile config.status | ||||
|  | ||||
| .PHONY: realclean | ||||
| realclean: distclean | ||||
|         rm -f tar.info* | ||||
| test: $(REDIS_SERVER_NAME) $(REDIS_CHECK_AOF_NAME) | ||||
| 	@(cd ..; ./runtest) | ||||
|  | ||||
| .PHONY: shar | ||||
| shar: $(SRCS) $(AUX) | ||||
|         shar $(SRCS) $(AUX) | compress \ | ||||
|           > tar-`sed -e '/version_string/!d' \ | ||||
|                      -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \ | ||||
|                      -e q | ||||
|                      version.c`.shar.Z | ||||
| test-sentinel: $(REDIS_SENTINEL_NAME) | ||||
| 	@(cd ..; ./runtest-sentinel) | ||||
|  | ||||
| .PHONY: dist | ||||
| dist: $(SRCS) $(AUX) | ||||
|         echo tar-`sed \ | ||||
|              -e '/version_string/!d' \ | ||||
|              -e 's/[^0-9.]*\([0-9.]*\).*/\1/' \ | ||||
|              -e q | ||||
|              version.c` > .fname | ||||
|         -rm -rf `cat .fname` | ||||
|         mkdir `cat .fname` | ||||
|         ln $(SRCS) $(AUX) `cat .fname` | ||||
|         tar chZf `cat .fname`.tar.Z `cat .fname` | ||||
|         -rm -rf `cat .fname` .fname | ||||
| check: test | ||||
|  | ||||
| tar.zoo: $(SRCS) $(AUX) | ||||
|         -rm -rf tmp.dir | ||||
|         -mkdir tmp.dir | ||||
|         -rm tar.zoo | ||||
|         for X in $(SRCS) $(AUX) ; do \ | ||||
|             echo $$X ; \ | ||||
|             sed 's/$$/^M/' $$X \ | ||||
|             > tmp.dir/$$X ; done | ||||
|         cd tmp.dir ; zoo aM ../tar.zoo * | ||||
|         -rm -rf tmp.dir | ||||
| lcov: | ||||
| 	$(MAKE) gcov | ||||
| 	@(set -e; cd ..; ./runtest --clients 1) | ||||
| 	@geninfo -o redis.info . | ||||
| 	@genhtml --legend -o lcov-html redis.info | ||||
|  | ||||
| test-sds: sds.c sds.h | ||||
| 	$(REDIS_CC) sds.c zmalloc.c -DSDS_TEST_MAIN $(FINAL_LIBS) -o /tmp/sds_test | ||||
| 	/tmp/sds_test | ||||
|  | ||||
| .PHONY: lcov | ||||
|  | ||||
| bench: $(REDIS_BENCHMARK_NAME) | ||||
| 	./$(REDIS_BENCHMARK_NAME) | ||||
|  | ||||
| 32bit: | ||||
| 	@echo "" | ||||
| 	@echo "WARNING: if it fails under Linux you probably need to install libc6-dev-i386" | ||||
| 	@echo "" | ||||
| 	$(MAKE) CFLAGS="-m32" LDFLAGS="-m32" | ||||
|  | ||||
| gcov: | ||||
| 	$(MAKE) REDIS_CFLAGS="-fprofile-arcs -ftest-coverage -DCOVERAGE_TEST" REDIS_LDFLAGS="-fprofile-arcs -ftest-coverage" | ||||
|  | ||||
| noopt: | ||||
| 	$(MAKE) OPTIMIZATION="-O0" | ||||
|  | ||||
| valgrind: | ||||
| 	$(MAKE) OPTIMIZATION="-O0" MALLOC="libc" | ||||
|  | ||||
| helgrind: | ||||
| 	$(MAKE) OPTIMIZATION="-O0" MALLOC="libc" CFLAGS="-D__ATOMIC_VAR_FORCE_SYNC_MACROS" | ||||
|  | ||||
| src/help.h: | ||||
| 	@../utils/generate-command-help.rb > help.h | ||||
|  | ||||
| install: all | ||||
| 	@mkdir -p $(INSTALL_BIN) | ||||
| 	$(REDIS_INSTALL) $(REDIS_SERVER_NAME) $(INSTALL_BIN) | ||||
| 	$(REDIS_INSTALL) $(REDIS_BENCHMARK_NAME) $(INSTALL_BIN) | ||||
| 	$(REDIS_INSTALL) $(REDIS_CLI_NAME) $(INSTALL_BIN) | ||||
| 	$(REDIS_INSTALL) $(REDIS_CHECK_RDB_NAME) $(INSTALL_BIN) | ||||
| 	$(REDIS_INSTALL) $(REDIS_CHECK_AOF_NAME) $(INSTALL_BIN) | ||||
| 	@ln -sf $(REDIS_SERVER_NAME) $(INSTALL_BIN)/$(REDIS_SENTINEL_NAME) | ||||
|  | ||||
| uninstall: | ||||
| 	rm -f $(INSTALL_BIN)/{$(REDIS_SERVER_NAME),$(REDIS_BENCHMARK_NAME),$(REDIS_CLI_NAME),$(REDIS_CHECK_RDB_NAME),$(REDIS_CHECK_AOF_NAME),$(REDIS_SENTINEL_NAME)} | ||||
		Reference in New Issue
	
	Block a user