makefile 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. # https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html
  2. # the compiler: gcc for C programs, defined as g++ for c++
  3. CC = g++
  4. #compiler flags:
  5. # -g adds debugging information to the executable file
  6. # -Wall turns off most, but not all compiler warnings
  7. CFLAGS = -std=c++14
  8. # define any libraries
  9. LIBS = -lpthread
  10. # define the source files
  11. SRCS = main.cpp Debug.cpp error_signals.cpp StackTrace.cpp
  12. # define the object files
  13. OBJS = $(SRCS:.cpp=.o)
  14. # define the main executable file
  15. MAIN = ShowErrorsInC++
  16. # The following part of the makefile is generic.
  17. # It can be used to make any executable just by changing the definitions above.
  18. .PHONY: depend clean
  19. all: $(MAIN)
  20. @echo ShowErrorsInC++ has been compiled
  21. $(MAIN): $(OBJS)
  22. $(CC) $(CFLAGS) -o $(MAIN) $(OBJS) $(LIBS)
  23. # this is a suffix replacement rule for building .o's from .c's
  24. # it uses automatic variables $<: the name of the prerequisite of
  25. # the rule (a .cpp file) and $@: the name of the target of the rule (a .o file)
  26. # (see the gnu make manual about automatic variables)
  27. .cpp.o:
  28. $(CC) $(CFLAGS) -c $< -o $@
  29. clean:
  30. $(RM) *.o *~ $(MAIN)
  31. depend: $(SRCS)
  32. makedepend $^
  33. # DO NOT DELETE THIS LINE -- make depend needs it