1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- # https://www.cs.swarthmore.edu/~newhall/unixhelp/howto_makefiles.html
- # the compiler: gcc for C programs, defined as g++ for c++
- CC = g++
- #compiler flags:
- # -g adds debugging information to the executable file
- # -Wall turns off most, but not all compiler warnings
- CFLAGS = -std=c++14
- # define any libraries
- LIBS = -lpthread
- # define the source files
- SRCS = main.cpp Debug.cpp error_signals.cpp StackTrace.cpp
- # define the object files
- OBJS = $(SRCS:.cpp=.o)
- # define the main executable file
- MAIN = ShowErrorsInC++
- # The following part of the makefile is generic.
- # It can be used to make any executable just by changing the definitions above.
- .PHONY: depend clean
- all: $(MAIN)
- @echo ShowErrorsInC++ has been compiled
- $(MAIN): $(OBJS)
- $(CC) $(CFLAGS) -o $(MAIN) $(OBJS) $(LIBS)
-
- # this is a suffix replacement rule for building .o's from .c's
- # it uses automatic variables $<: the name of the prerequisite of
- # the rule (a .cpp file) and $@: the name of the target of the rule (a .o file)
- # (see the gnu make manual about automatic variables)
- .cpp.o:
- $(CC) $(CFLAGS) -c $< -o $@
-
- clean:
- $(RM) *.o *~ $(MAIN)
- depend: $(SRCS)
- makedepend $^
- # DO NOT DELETE THIS LINE -- make depend needs it
|