Advertisement
2607

Makefile

Dec 4th, 2021
2,785
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.97 KB | None | 0 0
  1. CC=gcc
  2. LDFLAGS=-L. -ls21_string
  3. SOURCES=s21_string.c
  4. OBJECTS=$(SOURCES:.c=.o)
  5. GCOVFLAGS=--coverage
  6. HTML_CREATE=lcov -t a.out -o rep.info -c -d .; genhtml -o report rep.info
  7. OS=$(shell uname)
  8. ifeq ($(OS), Linux)
  9.     CHECK_FLAGS=  -lcheck -pthread -lrt -lm
  10.     fctvFl=-D_DEFAULT_SOURCE
  11.     OS_ERR=-DLINUX
  12. else
  13.     CHECK_FLAGS=`pkg-config --cflags --libs check`
  14.     OS_ERR=-DMACOS
  15. endif
  16. TEST_COMPILE=$(CC) test/tests.c libs21_string.a $(CHECK_FLAGS) -L. -ls21_string
  17.  
  18. all:clean s21_string.a test
  19.  
  20. clean:
  21.     rm -rf *.o *.g* *.info *.out report *.a
  22. rebuild: clean all
  23. test: s21_string.a
  24.     $(TEST_COMPILE)
  25.     ./a.out
  26. gcov_report: s21_string.a
  27.     rm -f *.g*
  28.     $(CC) $(SOURCES) test/tests.c libs21_string.a $(CHECK_FLAGS) $(LDFLAGS) $(GCOVFLAGS)
  29.     ./a.out
  30.     $(HTML_CREATE)
  31. s21_string.a: s21_string.o
  32.     ar rcs libs21_string.a s21_string.o
  33.     ranlib libs21_string.a
  34.     cp libs21_string.a s21_string.a
  35.     cp libs21_string.a ls21_string.a
  36. s21_string.o:
  37.     $(CC) -c s21_string.c $(OS_ERR)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement