Advertisement
Guest User

Untitled

a guest
Mar 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 1.25 KB | None | 0 0
  1. # Обычные дефайн
  2. CXX=g++
  3. CXXFLAGS += -std=c++17
  4.  
  5. all:
  6.     @echo "-----Homework presentation-----"
  7.  
  8. DYN: all.o
  9.     $(CXX) $(CXXFLAGS) -shared -L -Wl,-soname=libmylib.so.5 -o libmylib.so.5.1.10 hello.o here.o bye.o
  10.  
  11. # Static library creator       
  12. # НАДО УЗНАТЬ РАЗНИЦУ: "rvs" ?= "cr" ?= "rcs" ?= "rv"
  13. mylib.a: all.o
  14.     ar rv mylib.a here.o hello.o bye.o
  15.  
  16. # Create executable file
  17. start.exe: STAT clean.o
  18.     $(CXX) -o start main.cpp mylib.a
  19.  
  20. # Create executable file with define   
  21. startDefine.exe:
  22.     $(CXX) $(CXXFLAGS) -o startDefine -DNAME=\"Denis\" main.cpp hello.cpp here.cpp bye.cpp 
  23.    
  24. # Create executable file from static library
  25. startStaticLib.exe: mylib.a
  26.     $(CXX) $(CXXFLAGS) -o startStaticLib main.cpp mylib.a
  27.  
  28. # Object file creators
  29. # "-fPIC" for inclusion in a library
  30. all.o: hello.o here.o bye.o
  31.  
  32. main.o: main.cpp
  33.     $(CXX) $(CXXFLAGS) -c -fPIC main.cpp
  34.  
  35. hello.o: hello.cpp
  36.     $(CXX) $(CXXFLAGS) -c -fPIC hello.cpp
  37.  
  38. here.o: here.cpp
  39.     $(CXX) $(CXXFLAGS) -c -fPIC here.cpp   
  40.    
  41. bye.o: bye.cpp
  42.     $(CXX) $(CXXFLAGS) -c -fPIC bye.cpp
  43.    
  44. # File cleaners
  45. clean: clean.o clean.a clean.exe clean.so
  46.        
  47. clean.o:
  48.     rm -rf *.o  
  49.    
  50. clean.a:
  51.     rm -rf *.a
  52.    
  53. clean.exe:
  54.     rm -rf *.exe
  55.    
  56. clean.so:
  57.     rm -rf libmylib.*
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement