wc

Count words in <50 lines of C
Log | Files | Refs | README

makefile (669B)


      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=lc.c
     12 OUT=lc
     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/$(OUT)
     34 
     35 test: $(OUT)
     36 	/bin/echo -e "123\n45 67" | ./$(OUT)
     37 	/bin/echo -n "" | ./lc
     38 	/bin/echo "  xx x" | ./$(OUT) -w
     39 	./$(OUT) $(SRC)
     40 	./$(OUT) nonexistent_file || true