Moved versioning to premake; added OpenBSD support
This commit is contained in:
parent
522f268d05
commit
3d7c9baf3d
28
Makefile
28
Makefile
@ -1,20 +1,22 @@
|
||||
include premake.make
|
||||
|
||||
LIBNAME := $(shell basename $$(pwd))
|
||||
MAJOR := 1
|
||||
MINOR := 0.0
|
||||
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
LINKERNAME := $(LIBNAME).dylib
|
||||
SONAME := $(LIBNAME).$(MAJOR).dylib
|
||||
REALNAME := $(LINKERNAME)
|
||||
else
|
||||
endif
|
||||
ifeq ($(UNAME_S),OpenBSD)
|
||||
REALNAME := $(LIBNAME).so.$(MAJOR).$(MINOR)
|
||||
endif
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
LINKERNAME := $(LIBNAME).so
|
||||
SONAME := $(LINKERNAME).$(MAJOR)
|
||||
REALNAME := $(SONAME).$(MINOR)
|
||||
REALNAME := $(SONAME).$(MINOR).$(PATCH)
|
||||
endif
|
||||
STATICLIB := $(LIBNAME).a
|
||||
|
||||
BUILDDIR := build/intermediates/
|
||||
PREFIX ?= /usr/local
|
||||
@ -33,7 +35,7 @@ HDRS := $(wildcard src/*.hpp)
|
||||
|
||||
CXX ?= g++
|
||||
|
||||
CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -std=c++17 -fPIC
|
||||
CXXFLAGS += -Wshadow -Wall -Wpedantic -Wextra -g -fno-strict-aliasing -std=c++17 -fPIC
|
||||
ifeq ($(DEBUG),1)
|
||||
CXXFLAGS += -D DEBUG -O0
|
||||
CONFIG := debug
|
||||
@ -52,7 +54,7 @@ vpath %.o $(BUILDDIR)
|
||||
|
||||
.PHONY: all clean install prebuild test
|
||||
|
||||
all: prebuild $(OUTDIR)$(REALNAME)
|
||||
all: prebuild $(OUTDIR)$(REALNAME) $(OUTDIR)$(STATICLIB)
|
||||
|
||||
prebuild:
|
||||
@mkdir -p $(BUILDDIR) $(OUTDIR)
|
||||
@ -60,7 +62,11 @@ prebuild:
|
||||
$(OUTDIR)$(REALNAME): $(OBJS) $(DEPS)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
$(CXX) -dynamiclib -o $(OUTDIR)$(REALNAME) -current_version $(MAJOR) -compatibility_version $(MINOR) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
|
||||
else
|
||||
endif
|
||||
ifeq ($(UNAME_S),OpenBSD)
|
||||
$(CXX) -g -shared -Wl,-soname,$(REALNAME) -o $(OUTDIR)$(REALNAME) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
|
||||
endif
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
$(CXX) -g -shared -Wl,-soname,$(SONAME) -o $(OUTDIR)$(REALNAME) $(LDFLAGS) $(LDLIBS) $(addprefix $(BUILDDIR),$(OBJS))
|
||||
endif
|
||||
|
||||
@ -72,6 +78,9 @@ endif
|
||||
|
||||
%.d: ;
|
||||
|
||||
$(OUTDIR)$(STATICLIB): $(OBJS)
|
||||
ar r $(OUTDIR)$(STATICLIB) $(addprefix $(BUILDDIR),$(OBJS))
|
||||
|
||||
$(LIBNAME).hpp: $(HDRS)
|
||||
@echo updating build/$(LIBNAME).hpp
|
||||
@cp /dev/null build/$(LIBNAME).hpp
|
||||
@ -94,7 +103,8 @@ install: $(OUTDIR)$(REALNAME) $(LIBNAME).hpp
|
||||
$(INSTALL) -m 644 build/$(LIBNAME).hpp $(INCLUDEDIR)
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
cd $(LIBDIR) && ln -sf $(REALNAME) $(SONAME)
|
||||
else
|
||||
endif
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
ldconfig
|
||||
cd $(LIBDIR) && ln -sf $(SONAME) $(LINKERNAME)
|
||||
endif
|
||||
|
@ -1 +1,5 @@
|
||||
LDLIBS := -lcairo -lscnumerics
|
||||
|
||||
MAJOR := 1
|
||||
MINOR := 0
|
||||
PATCH := 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user