Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. CXX = g++
  2. CXXFLAGS += -std=c++17
  3. SRCS = hello.cpp bye.cpp here.cpp
  4. OBJS = $(SRCS:.cpp=.o)
  5. TARGET_LIB = libmylib.a
  6. TARGET_EXE = output
  7.  
  8. .PHONY: all clean
  9.  
  10. all: $(TARGET_LIB) $(TARGET_EXE)
  11.  
  12. $(TARGET_EXE): main.o $(TARGET_LIB)
  13. $(CXX) $(CXXFLAGS) -o $(TARGET_EXE) main.o -L. -lmylib
  14.  
  15. %.o: %.cpp
  16. $(CXX) $(CXXFLAGS) -c $<
  17.  
  18. $(TARGET_LIB): $(OBJS)
  19. ar cr $(TARGET_LIB) $(OBJS)
  20.  
  21. clean:
  22. rm -f $(OBJS) $(TARGET_EXE) $(TARGET_LIB) main.o
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement