Advertisement
Guest User

fs_makefile

a guest
Jun 20th, 2018
307
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Make 0.74 KB | None | 0 0
  1. prefix ?= /usr/local
  2.  
  3. PROG_NAME = prog
  4.  
  5. CPPFLAGS += -O3 -Wall -std=c++17 -I./include -Wno-unused-function -Wno-sign-compare
  6. LIBS += -lz -lstdc++fs
  7.  
  8. vpath %.c src
  9. vpath %.o src
  10. vpath %.hpp include
  11. vpath %.h include
  12.  
  13. files := $(notdir $(wildcard src/*.cpp))
  14. objects := $(addprefix src/,$(files:%.cpp=%.o))
  15.  
  16. .PHONY: all debug build install clean
  17.  
  18. all: build
  19.  
  20. debug: CPPFLAGS = -Wall -O0 -std=c++17 -I./include -Wno-unused-function -Wno-sign-compare -pg -D_DEBUG
  21. debug: build
  22.  
  23. build: bin/$(PROG_NAME)
  24.  
  25. bin/$(PROG_NAME) : $(objects)
  26.     mkdir -p bin
  27.     $(CXX) $(CPPFLAGS) -o bin/$(PROG_NAME) $^ $(LDFLAGS) $(LIBS)
  28.  
  29. src/%.o : %.c
  30.     $(CXX) $(CPPFLAGS) -c -o $@ $< $(LIBS)
  31.  
  32. install:
  33.     install bin/$(PROG_NAME) $(prefix)/bin/$(PROG_NAME)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement