makefile 374 B

1234567891011121314151617
  1. CC = gcc
  2. CFLAGS = -g -Wall -Wextra -Werror -std=c17 -lpthread
  3. # test2.o: test2.c
  4. # $(CC) $(CFLAGS) -c test2.c -o test2.o
  5. # test1.o: test1.c
  6. # $(CC) $(CFLAGS) -c test1.c -o test1.o
  7. %.o: %.c
  8. $(CC) $(CFLAGS) -c $^ -o $@
  9. objfiles = test1.o test2.o
  10. test: $(objfiles)
  11. $(CC) $(CFLAGS) $^ -o $@
  12. all: test
  13. @echo "Build complete"
  14. .PHONY: clean
  15. clean:
  16. rm -f test1.o test2.o test