Advertisement
2607

Makefile

Dec 5th, 2021
3,070
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.81 KB | None | 0 0
  1.  
  2. OS := $(shell uname -s)
  3.  
  4. ifeq ($(OS), Darwin)
  5.     CHECK=-lcheck
  6. else
  7.     CHECK=-lcheck -lsubunit -lm -lrt -lpthread -D_GNU_SOURCE
  8. endif
  9.  
  10. all: s21_cat s21_grep test
  11.  
  12. test: unittest.o
  13.     sh test.sh
  14.     gcc unittest.o -o a.out $(CHECK)
  15.  
  16. s21_cat.o: cat/s21_cat.c
  17.     gcc -Wall -Werror -Wextra -c cat/s21_cat.c -o cat/s21_cat.o
  18.  
  19. s21_grep.o: grep/s21_grep.c
  20.     gcc -Wall -Werror -Wextra -c grep/s21_grep.c -o grep/s21_grep.o
  21.  
  22. s21_cat: cat/s21_cat.o
  23.     gcc cat/s21_cat.o -o cat/s21_cat
  24.  
  25. s21_grep: grep/s21_grep.o
  26.     gcc grep/s21_grep.o -o grep/s21_grep -D_GNU_SOURCE
  27.  
  28. clean:
  29.     rm -rf cat/s21_cat.o grep/s21_grep.o
  30.     rm -rf cat/s21_cat grep/s21_grep
  31.     rm -rf a.out
  32.     rm -rf s21_cat_lot.txt
  33.     rm -rf s21_grep_lot.txt
  34.     rm -rf *.o
  35.  
  36. unittest.o: test.c
  37.     gcc -Wall -Werror -Wextra -c test.c -o unittest.o
  38.  
  39. rebuild: clean all
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement