Created
          February 6, 2017 15:27 
        
      - 
      
 - 
        
Save catb0t/f88e390b014c91d7452a44737fb1a473 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Clang C: -Wall -Wextra -Wfloat-equal -Winline -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wunreachable-code -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors -ggdb -Wredundant-decls -Wuninitialized -Wstrict-prototypes -Wmissing-prototypes -std=gnu11 -c -Wno-language-extension-token -Wno-gnu | |
| Clang C++: -Wall -Wextra -Wfloat-equal -Winline -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wunreachable-code -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors -ggdb -Wredundant-decls -Wuninitialized -std=c++14 | |
| GCC C: -Wall -Wextra -Wfloat-equal -Winline -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wunreachable-code -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors -Wredundant-decls -Wuninitialized | |
| -Wstrict-prototypes -Wmissing-prototypes -std=gnu11 -xc -c | |
| GCC C++: -Wall -Wextra -Wfloat-equal -Winline -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wunreachable-code -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors -ggdb -Wredundant-decls -Wuninitialized -std=c++14 -xc++ -c | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | FILENAME := $(shell basename `pwd`) | |
| ARCH := $(shell uname -m) | |
| OUT_FILENAME := $(FILENAME) | |
| DEBUG_OPTS := -Wall -Wextra -Wfloat-equal -Winline -Wundef -Werror -fverbose-asm -Wint-to-pointer-cast -Wshadow -Wpointer-arith -Wcast-align -Wcast-qual -Wunreachable-code -Wstrict-overflow=5 -Wwrite-strings -Wconversion --pedantic-errors -ggdb -Wredundant-decls -Werror=maybe-uninitialized | |
| MEM_OPTS := -fstack-protector -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer | |
| OPTS := -lm ../fnv-hash/libfnv.a | |
| ifeq ($(CCPLUS), 1) | |
| OPTS += -std=c++14 | |
| CC := c++ | |
| else | |
| OPTS += -std=gnu11 | |
| DEBUG_OPTS += -Wstrict-prototypes -Wmissing-prototypes | |
| endif | |
| ifeq ($(CC), g++) | |
| #MEM_OPTS += -static-libasan -static-libtsan -static-liblsan -static-libubsan -lasan -lubsan | |
| endif | |
| ifeq ($(CC), gcc) | |
| #DEBUG_OPTS += -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn | |
| MEM_OPTS += -static-libasan -static-libtsan -static-liblsan -static-libubsan -lasan -lubsan | |
| endif | |
| ifeq ($(CC), cc) | |
| #DEBUG_OPTS += -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=noreturn | |
| MEM_OPTS += -static-libasan -static-libtsan -static-liblsan -static-libubsan -lasan -lubsan | |
| endif | |
| CMD_ARGS ?= | |
| FILES := $(FILENAME).c $(FILENAME).h | |
| OPTIONAL = $(if $(wildcard test_$(FILENAME).c), test, ) | |
| all: normal debug mem $(OPTIONAL) | |
| spec: arm optifine | |
| normal: $(FILES) | |
| $(CC) $(FILENAME).c $(CMD_ARGS) $(OPTS) -o ./bin/$(OUT_FILENAME) | |
| @echo | |
| debug: $(FILES) | |
| $(CC) $(FILENAME).c $(CMD_ARGS) $(DEBUG_OPTS) $(OPTS) -o ./bin/debug_$(OUT_FILENAME) | |
| @echo | |
| optifine: $(FILES) | |
| $(CC) $(FILENAME).c $(CMD_ARGS) $(DEBUG_OPTS) $(OPTS) -o ./bin/optifine_$(OUT_FILENAME) -O3 | |
| @echo | |
| mem: $(FILES) | |
| $(CC) $(FILENAME).c $(CMD_ARGS) $(MEM_OPTS) $(DEBUG_OPTS) $(OPTS) -o ./bin/memdebug_$(OUT_FILENAME) | |
| @echo | |
| test: test_$(FILENAME).c | |
| $(CC) test_$(FILENAME).c $(CMD_ARGS) $(OPTS) -o ./bin/test_$(OUT_FILENAME) -lcriterion | |
| @echo | |
| arm: $(FILES) | |
| arm-linux-gnueabi-gcc $(CMD_ARGS) -DARM -static -march=armv7-a $(FILENAME).c -lm -o ./bin/$(FILENAME)_armo -O3 | |
| @echo | |
| clean: | |
| (rm core *core* a.out 2>/dev/null; echo) | |
| $(shell find . -type f -executable -regextype sed -iregex '\./[^.]*' | xargs rm) | |
| @echo | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment