41 lines
		
	
	
		
			669 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
		
			669 B
		
	
	
	
		
			Makefile
		
	
	
	
	
	
| # Interface: 
 | |
| #   make
 | |
| #   make build
 | |
| #   make format
 | |
| 
 | |
| # Compiler
 | |
| CC=gcc
 | |
| # CC=tcc # <= faster compilation
 | |
| 
 | |
| # Main file
 | |
| SRC=ww.c
 | |
| OUT=ww
 | |
| 
 | |
| ## Flags
 | |
| DEBUG= #'-g'
 | |
| STANDARD=-std=c99
 | |
| WARNINGS=-Wall
 | |
| OPTIMIZED=-O3
 | |
| # OPTIMIZED=-O3  #-Ofast
 | |
| 
 | |
| ## Formatter
 | |
| STYLE_BLUEPRINT=webkit
 | |
| FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
 | |
| 
 | |
| ## make build
 | |
| build: $(SRC)
 | |
| 	$(CC) $(OPTIMIZED) $(DEBUG) $(SRC) -o $(OUT)
 | |
| 
 | |
| format: $(SRC)
 | |
| 	$(FORMATTER) $(SRC)
 | |
| 
 | |
| install:
 | |
| 	cp -n $(OUT) /bin/$(OUT)
 | |
| 
 | |
| test: $(OUT)
 | |
| 	/bin/echo -e "123\n45 67" | ./$(OUT)
 | |
| 	/bin/echo -n "" | ./ww
 | |
| 	/bin/echo "  xx x" | ./$(OUT) -w
 | |
| 	./$(OUT) $(SRC)
 | |
| 	./$(OUT) nonexistent_file || true
 |