sources now taken from src directory
This commit is contained in:
parent
5e9b21de30
commit
f8ea704231
31
Makefile
31
Makefile
@ -1,17 +1,15 @@
|
||||
LDLIBS := -lm -lpthread -lcurl -lsclogging
|
||||
|
||||
BIN := $(shell basename $$(pwd))
|
||||
|
||||
MANSECTION := 1
|
||||
MANPAGE := $(BIN).$(MANSECTION)
|
||||
|
||||
SRCS := $(notdir $(wildcard src/*.cpp))
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
DEPS := $(SRCS:.cpp=.d)
|
||||
|
||||
BUILDDIR := build/intermediates/
|
||||
|
||||
SRCS := $(wildcard *.cpp)
|
||||
OBJS := $(addprefix $(BUILDDIR),$(SRCS:.cpp=.o))
|
||||
DEPS := $(addprefix $(BUILDDIR),$(SRCS:.cpp=.d))
|
||||
|
||||
CXX ?= g++
|
||||
PKG_CONFIG ?= pkg-config
|
||||
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
CONFIGDIR ?= $(PREFIX)/etc
|
||||
@ -19,6 +17,7 @@ DATADIR ?= $(PREFIX)/share
|
||||
MANDIR ?= $(DATADIR)/man/man
|
||||
DOCDIR ?= $(DATADIR)/$(BIN)/doc
|
||||
|
||||
CXX ?= g++
|
||||
RM := /bin/rm -rf
|
||||
INSTALL := /usr/bin/install -c
|
||||
|
||||
@ -30,11 +29,12 @@ else
|
||||
CXXFLAGS += -D NDEBUG -O3
|
||||
CONFIG := release
|
||||
endif
|
||||
|
||||
LDLIBS := -lm -lpthread -lcurl -lsclogging
|
||||
|
||||
OUTDIR := build/$(CONFIG)/
|
||||
|
||||
vpath %.cpp src
|
||||
vpath %.d $(BUILDDIR)
|
||||
vpath %.o $(BUILDDIR)
|
||||
|
||||
.PHONY: all clean install prebuild
|
||||
|
||||
all: prebuild $(OUTDIR)$(BIN)
|
||||
@ -43,15 +43,16 @@ prebuild:
|
||||
@mkdir -p $(BUILDDIR) $(OUTDIR)
|
||||
|
||||
$(OUTDIR)$(BIN): $(OBJS) $(DEPS)
|
||||
$(CXX) $(OBJS) $(LDFLAGS) $(LDLIBS) -o $(OUTDIR)$(BIN)
|
||||
$(CXX) $(addprefix $(BUILDDIR),$(OBJS)) $(LDFLAGS) $(LDLIBS) -o $(OUTDIR)$(BIN)
|
||||
@ln -sf $(OUTDIR)$(BIN) $(BIN)
|
||||
|
||||
$(BUILDDIR)%.o: %.cpp $(BUILDDIR)%.d Makefile
|
||||
cd $(BUILDDIR) && $(CXX) $(CXXFLAGS) -MMD -MP -MT $(notdir $@) -MF $*.d -c ../../$< && cd ../..
|
||||
%.o: %.cpp %.d
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
|
||||
@mv $@ $*.d $(BUILDDIR)
|
||||
|
||||
-include $(BUILDDIR)*.d
|
||||
|
||||
$(BUILDDIR)%.d: ;
|
||||
%.d: ;
|
||||
|
||||
clean:
|
||||
$(RM) build $(BIN)
|
||||
|
Loading…
x
Reference in New Issue
Block a user