repeat.git


repeat

~ repeat a command n times
git clone https://github.com/djnnvx/repeat.git
log | files | refs | archive | README

Makefile (1336B)

      1 
      2 NAME		 	= repeat
      3 CC			 	= clang
      4 RM			 	= rm -rf
      5 
      6 INCLUDES 	 	= -I./includes/
      7 LINK_FLAG    	=
      8 
      9 CFLAGS 			= -Wno-unused-command-line-argument -fPIC
     10 CFLAGS 			+= -g3 -DDEBUG -Wno-format-security -Wno-visibility -DCLIENTID=DEBUG -Wno-unsafe-buffer-usage
     11 CFLAGS 			+= -Wno-unused-macros
     12 
     13 
     14 
     15 PATTERN 	 	= .c
     16 OBJPATTERN  	= .o
     17 SRC_DIR 		= ./sources
     18 OBJECT_DIR 		= ./objects
     19 
     20 vpath %$(PATTERN) $(SRC_DIR)
     21 
     22 MAIN		 	= main.c
     23 SRC 		 	= lib.c
     24 
     25 
     26 COMBINED		= $(SRC) $(MAIN)
     27 OBJ 	 		= $(patsubst %$(PATTERN), $(OBJECT_DIR)/%$(OBJPATTERN), $(COMBINED))
     28 
     29 
     30 .PHONY: all
     31 all: directories $(NAME) ## compile binary
     32 	@echo "   [*** DONE ***]"
     33 
     34 .PHONY: help
     35 help:
     36 	@echo "\033[34mtargets for repeat:\033[0m"
     37 	@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}'
     38 
     39 .PHONY: install
     40 install: all ## builds and moves binary to /usr/bin/. (might have to run as root)
     41 	@mv $(NAME) /usr/bin/$(NAME)
     42 
     43 
     44 $(OBJECT_DIR):
     45 	@mkdir -pv $@
     46 
     47 directories: | $(OBJECT_DIR)
     48 
     49 $(OBJECT_DIR)/%$(OBJPATTERN) : %$(PATTERN)
     50 	@$(CC) -o $@ -c $< $(CFLAGS) $(INCLUDES) $(LINK_FLAG)
     51 	@echo "Compiling $@"
     52 
     53 $(NAME): $(OBJ)
     54 	@$(CC) -o $(NAME) $^ $(CFLAGS) $(INCLUDES) $(LINK_FLAG)
     55 	@echo "[*** COMPILATION  SUCCESSFUL ***]"
     56 
     57 .PHONY: clean
     58 clean:  ## removes object files
     59 	@$(RM) objects
     60 
     61