makefile (701B)
1 # Interface: 2 # make 3 # make build 4 # make format 5 6 # Compiler 7 CC=gcc 8 # CC=tcc # <= faster compilation 9 10 # Main file 11 SRC=wc.c 12 OUT=wc 13 14 ## Flags 15 DEBUG= #'-g' 16 STANDARD=-std=c99 17 WARNINGS=-Wall 18 OPTIMIZED=-O3 19 # OPTIMIZED=-O3 #-Ofast 20 21 ## Formatter 22 STYLE_BLUEPRINT=webkit 23 FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT) 24 25 ## make build 26 build: $(SRC) 27 $(CC) $(OPTIMIZED) $(DEBUG) $(SRC) -o $(OUT) 28 29 format: $(SRC) 30 $(FORMATTER) $(SRC) 31 32 install: 33 cp -n $(OUT) /bin/ww ## don't overwrite old standard wc. 34 35 test: $(OUT) 36 /bin/echo -e "123\n45 67" | ./$(OUT) 37 /bin/echo -n "" | ./wc 38 /bin/echo " xx x" | ./$(OUT) -w 39 ./$(OUT) $(SRC) 40 ./$(OUT) nonexistent_file || true