Fixed Makfile
This commit is contained in:
parent
b5b369b080
commit
96dba49bf1
31
Makefile
31
Makefile
@ -1,20 +1,19 @@
|
||||
LDLIBS := -lm -lpthread -lcurl -lsclogging
|
||||
include premake.make
|
||||
|
||||
BIN := $(shell basename $$(pwd))
|
||||
|
||||
MANSECTION := 1
|
||||
MANSECTION ?= 1
|
||||
MANPAGE := $(BIN).$(MANSECTION)
|
||||
|
||||
SRCS := $(notdir $(wildcard src/*.cpp))
|
||||
OBJS := $(SRCS:.cpp=.o)
|
||||
DEPS := $(SRCS:.cpp=.d)
|
||||
|
||||
BUILDDIR := build/intermediates/
|
||||
PREFIX ?= /usr/local
|
||||
BINDIR ?= $(PREFIX)/bin
|
||||
MANDIR ?= $(PREFIX)/man/man
|
||||
CONFIGDIR ?= $(PREFIX)/etc
|
||||
DATADIR ?= $(PREFIX)/share
|
||||
MANDIR ?= $(DATADIR)/man/man
|
||||
DOCDIR ?= $(DATADIR)/$(BIN)/doc
|
||||
|
||||
CXX ?= g++
|
||||
@ -35,30 +34,36 @@ vpath %.cpp src
|
||||
vpath %.d $(BUILDDIR)
|
||||
vpath %.o $(BUILDDIR)
|
||||
|
||||
.PHONY: all clean install prebuild
|
||||
.PHONY: all clean install prebuild test dist-clean
|
||||
|
||||
all: prebuild $(OUTDIR)$(BIN)
|
||||
|
||||
prebuild:
|
||||
@mkdir -p $(BUILDDIR) $(OUTDIR)
|
||||
|
||||
$(OUTDIR)$(BIN): $(OBJS) $(DEPS)
|
||||
$(CXX) $(addprefix $(BUILDDIR),$(OBJS)) $(LDFLAGS) $(LDLIBS) -o $(OUTDIR)$(BIN)
|
||||
$(OUTDIR)$(BIN): $(OBJS)
|
||||
$(CXX) -o $(OUTDIR)$(BIN) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
|
||||
@ln -sf $(OUTDIR)$(BIN) $(BIN)
|
||||
|
||||
%.o: %.cpp %.d
|
||||
%.o %.d: %.cpp
|
||||
$(CXX) $(CXXFLAGS) -MMD -MP -MT $@ -MF $*.d -c $<
|
||||
@mv $@ $*.d $(BUILDDIR)
|
||||
|
||||
-include $(BUILDDIR)*.d
|
||||
-include $(BUILDDIR)$(SRCS:.cpp=.d)
|
||||
|
||||
%.d: ;
|
||||
test:
|
||||
$(MAKE) -C tests && tests/tests
|
||||
|
||||
clean:
|
||||
$(RM) build $(BIN)
|
||||
$(RM) $(BUILDDIR)
|
||||
$(MAKE) -C tests clean
|
||||
|
||||
install: $(OUTDIR)$(BIN)
|
||||
dist-clean:
|
||||
$(RM) build $(BIN)
|
||||
$(MAKE) -C tests clean
|
||||
|
||||
install:
|
||||
$(INSTALL) -d $(BINDIR)
|
||||
$(INSTALL) $(OUTDIR)$(BIN) $(BINDIR)
|
||||
$(INSTALL) -d $(MANDIR)$(MANSECTION)
|
||||
$(INSTALL) $(MANPAGE) $(MANDIR)$(MANSECTION)
|
||||
$(INSTALL) -m 0644 $(MANPAGE) $(MANDIR)$(MANSECTION)
|
||||
|
Loading…
x
Reference in New Issue
Block a user