Advertisement
oneno

Makefile and output for make

Jan 3rd, 2023
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Makefile:
  2.  
  3. ```
  4. # Makefile for Writing Make Files Example
  5.  
  6. # *****************************************************
  7. # Variables to control Makefile operation
  8.  
  9. # the compiler: gcc for C program, define as g++ for C++
  10. CC = g++
  11.  
  12. # compiler flags:
  13. # -g - this flag adds debugging information to the executable file
  14. # -Wall - this flag is used to turn on most compiler warnings
  15. CFLAGS = -Wall -g -std=c++14
  16.  
  17. # ****************************************************
  18. # Targets needed to bring the executable up to date
  19.  
  20. # The build target
  21. TARGET = AccountTest
  22. OUT = app
  23.  
  24. main: $(TARGET).o
  25. $(CC) $(CFLAGS) -o $(OUT) $(TARGET).o
  26.  
  27. # The main.o target can be written more simply
  28.  
  29. $(TARGET).o: $(TARGET).cpp
  30. $(CC) $(CFLAGS) -c $(TARGET).cpp
  31.  
  32. clean:
  33. $(RM) $(OUT) $(TARGET).o
  34.  
  35. ```
  36.  
  37. Output for make:
  38. ```
  39. $ make
  40. g++ -Wall -g -std=c++14 -c AccountTest.cpp
  41. g++ -Wall -g -std=c++14 -o app AccountTest.o
  42. $
  43. ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement