Advertisement
2607

grep_Makefile

Dec 5th, 2021
2,260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.81 KB | None | 0 0
  1. CC=gcc
  2. CAR=ar
  3. CRANLIB=ranlib
  4.  
  5. OS = $(shell uname)
  6.  
  7. ifeq ($(OS), Linux)
  8.     LINUX_LIBS=-lsubunit -lrt -lpthread -lm
  9. else
  10.     LINUX_LIBS=
  11. endif
  12.  
  13. # FLAGS=-Wall -Werror -Wextra -std=c11
  14. # FLAGS=-Wall -Wextra
  15.  
  16. #CHECKLIB=-I../../.brew/include
  17. #CHECKLIB=-I../../../.brew/include -L../../../.brew/Cellar/check/0.15.2/lib
  18. LCHECK=`pkg-config --cflags --libs check`
  19.  
  20. FILE1=s21_grep
  21. FILE2=test_grep
  22.  
  23. TARGETDIR=./
  24.  
  25. all: s21_grep
  26.  
  27. s21_grep: $(FILE1).c
  28.     $(CC) -o $(TARGETDIR)$(FILE1) $(FLAGS) $(FILE1).c
  29.  
  30. test: s21_grep
  31.     $(CC) -o $(TARGETDIR)$(FILE2) $(FLAGS) $(FILE2).c $(CHECKLIB) $(LCHECK)
  32.     -./$(FILE2)
  33.  
  34. clean:
  35.     rm -rf  *.o *.a *.out 1 2
  36.     rm -rf $(TARGETDIR)$(FILE1)
  37.     rm -rf $(TARGETDIR)$(FILE2)
  38.  
  39.  
  40. # Frequent typo
  41. claen:  clean
  42. clear:  clean
  43. claer:  clean
  44.  
  45. rebuild:
  46.     make clean
  47.     make all
  48.     rm -rf  *.o *.a
  49.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement