- Create initial 0.1.6 changelog

- Makefiles can now be called from sub directories
- Makefiles know includes and recompile if they are changed (linux, macosx)
- Build all tests except SingletonDll with the static library (linux, macosx)


git-svn-id: svn://svn.code.sf.net/p/loki-lib/code/trunk@695 7ec92016-0320-0410-acc4-a06ded1c099a
This commit is contained in:
lfittl 2006-07-14 07:31:37 +00:00
parent 81c7b0d3db
commit 3de4a064cb
25 changed files with 244 additions and 135 deletions

View file

@ -1,5 +1,11 @@
_____________________________________
Version 0.1.6
???, 2006
_____________________________________
_____________________________________
Version 0.1.5
June 19, 2006
_____________________________________

View file

@ -1,8 +1,4 @@
export VERSION = 0.1.5
export OS ?= $(shell uname -s)
export CXXWARNFLAGS = -Wall -Wold-style-cast -Wundef -Wsign-compare -Wconversion -Wpointer-arith -pedantic
export CXXFLAGS = $(CXXWARNFLAGS) -g -O2
include Makefile.common
.PHONY: all build-static build-shared check clean distclean
all: build-static build-shared check
@ -12,7 +8,7 @@ build-static:
build-shared:
$(MAKE) -C src build-shared
check: build-shared
check: build-static build-shared
$(MAKE) -C test
clean:
@ -23,8 +19,6 @@ distclean: clean
$(MAKE) -C src distclean
ifneq ($(OS),Windows)
export prefix ?= /usr
.PHONY: install install-static
install:
$(MAKE) -C src install-static

7
Makefile.common Normal file
View file

@ -0,0 +1,7 @@
VERSION := 0.1.6
OS ?= $(shell uname -s)
CXXWARNFLAGS := -Wall -Wold-style-cast -Wundef -Wsign-compare -Wconversion -Wpointer-arith -pedantic
CXXFLAGS := $(CXXWARNFLAGS) -g -O2
prefix := /usr

26
Makefile.deps Normal file
View file

@ -0,0 +1,26 @@
.PHONY: cleandeps
ifneq ($(OS),Windows)
.static-dep/%.dep: %.cpp
@mkdir -p $(dir $@)
$(CXX) -MM -MT $(patsubst %.cpp,%.o,$<) $(CPPFLAGS) $< > $@
.shared-dep/%.dep: %.cpp
@mkdir -p $(dir $@)
$(CXX) -MM -MT $(patsubst %.cpp,%.lo,$<) $(CPPFLAGS) $< > $@
ifneq ($(MAKECMDGOALS),clean)
ifneq ($(MAKECMDGOALS),distclean)
-include $(addprefix .static-dep/,$(SRC:.cpp=.dep))
-include $(addprefix .shared-dep/,$(SRC:.cpp=.dep))
endif
endif
cleandeps:
$(RM) -R .static-dep
$(RM) -R .shared-dep
else
cleandeps:
endif

View file

@ -1,3 +1,5 @@
include ../Makefile.common
.PHONY: install
install:
mkdir -p $(prefix)/include/loki

View file

@ -1,29 +1,31 @@
SRC = $(wildcard *.cpp)
STATIC_OBJ = $(SRC:.cpp=.o)
SHARED_OBJ = $(SRC:.cpp=.lo)
include ../Makefile.common
SRC := $(wildcard *.cpp)
STATIC_OBJ := $(SRC:.cpp=.o)
SHARED_OBJ := $(SRC:.cpp=.lo)
override CPPFLAGS += -I../include -DNDEBUG
STATIC_LIB = libloki.a
STATIC_LIB := libloki.a
ifeq ($(OS), Darwin)
SHARED_LIB_BASE = libloki.dylib
SHARED_LIB_VERSIONED = libloki.$(VERSION).dylib
SHARED_LIB_BASE := libloki.dylib
SHARED_LIB_VERSIONED := libloki.$(VERSION).dylib
override LDFLAGS += -dynamiclib -single_module -install_name $(SHARED_LIB_VERSIONED) -fPIC
LDLIBS = -lpthread
RESULT_DIR = ../lib/
LDLIBS := -lpthread
RESULT_DIR := ../lib/
else
ifeq ($(OS), Linux)
SHARED_LIB_BASE = libloki.so
SHARED_LIB_VERSIONED = libloki.so.$(VERSION)
SHARED_LIB_BASE := libloki.so
SHARED_LIB_VERSIONED := libloki.so.$(VERSION)
override LDFLAGS += --shared -Wl,-soname=$(SHARED_LIB_VERSIONED) -fPIC
LDLIBS = -lpthread
RESULT_DIR = ../lib/
LDLIBS := -lpthread
RESULT_DIR := ../lib/
else
SHARED_LIB_BASE = libloki.dll
SHARED_LIB_BASE := libloki.dll
override LDFLAGS += --shared
LDLIBS =
RESULT_DIR = ../lib/
LDLIBS :=
RESULT_DIR := ../lib/
endif
endif
@ -38,14 +40,14 @@ ifneq ($(OS), Windows)
$(RM) $(SHARED_OBJ)
endif
distclean: clean
distclean: clean cleandeps
$(RM) $(RESULT_DIR)$(STATIC_LIB)
$(RM) $(RESULT_DIR)$(SHARED_LIB_BASE)
ifneq ($(OS),Windows)
$(RM) $(RESULT_DIR)$(SHARED_LIB_VERSIONED)
INSTALL = install
INSTALL_DATA = $(INSTALL) -m 644
INSTALL := install
INSTALL_DATA := $(INSTALL) -m 644
.PHONY: install install-static install-shared
install: install-static install-shared
@ -73,3 +75,5 @@ endif
$(RESULT_DIR)$(STATIC_LIB): $(STATIC_OBJ)
$(AR) $(ARFLAGS) $@ $^
include ../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = DeletableSingleton$(BIN_SUFFIX)
SRC = DeletableSingleton.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := DeletableSingleton$(BIN_SUFFIX)
SRC := DeletableSingleton.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = Factory$(BIN_SUFFIX)
SRC = Factory.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := Factory$(BIN_SUFFIX)
SRC := Factory.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = FunctionTest$(BIN_SUFFIX)
SRC = FunctionTest.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := FunctionTest$(BIN_SUFFIX)
SRC := FunctionTest.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,17 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
LDLIBS += -lpthread
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,14 +1,16 @@
BIN1 = main$(BIN_SUFFIX)
SRC1 = main.cpp
OBJ1 = $(SRC1:.cpp=.o)
BIN2 = main2$(BIN_SUFFIX)
SRC2 = main2.cpp
OBJ2 = $(SRC2:.cpp=.o)
override CXXFLAGS = $(CXXWARNFLAGS) -g -fexpensive-optimizations -O3
include ../Makefile.common
BIN1 := main$(BIN_SUFFIX)
SRC1 := main.cpp
OBJ1 := $(SRC1:.cpp=.o)
BIN2 := main2$(BIN_SUFFIX)
SRC2 := main2.cpp
OBJ2 := $(SRC2:.cpp=.o)
CXXFLAGS := $(CXXWARNFLAGS) -g -fexpensive-optimizations -O3
.PHONY: all clean
all: $(BIN1) $(BIN2)
clean:
clean: cleandeps
$(RM) $(BIN1)
$(RM) $(OBJ1)
$(RM) $(BIN2)
@ -19,3 +21,5 @@ $(BIN1): $(OBJ1)
$(BIN2): $(OBJ2)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,13 +1,3 @@
export CPPFLAGS = -I../../include -DNDEBUG
export LDFLAGS = -L../../lib
export LDLIBS = -lloki
ifeq ($(OS),Windows)
export BIN_SUFFIX = .exe
else
export BIN_SUFFIX =
endif
SUBTARGETS_ORIG := $(patsubst %/,%,$(dir $(wildcard */Makefile)))
SUBTARGETS := $(filter-out $(SUBTARGETS_FILTER_OUT),$(SUBTARGETS_ORIG))

11
test/Makefile.common Normal file
View file

@ -0,0 +1,11 @@
include ../../Makefile.common
override CPPFLAGS += -I../../include -DNDEBUG
override LDFLAGS += -L../../lib -static
LDLIBS := -lloki
ifeq ($(OS),Windows)
BIN_SUFFIX := .exe
else
BIN_SUFFIX :=
endif

View file

@ -1,12 +1,16 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,10 +1,12 @@
BIN1 = main$(BIN_SUFFIX)
SRC1 = main.cpp
OBJ1 = $(SRC1:.cpp=.o)
LIB1 = libfoo.a
SRC2 = foo.cpp
OBJ2 = $(SRC2:.cpp=.o)
override CPPFLAGS += -DLOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT
include ../Makefile.common
BIN1 := main$(BIN_SUFFIX)
SRC1 := main.cpp
OBJ1 := $(SRC1:.cpp=.o)
LIB1 := libfoo.a
SRC2 := foo.cpp
OBJ2 := $(SRC2:.cpp=.o)
CPPFLAGS += -DLOKI_FUNCTOR_IS_NOT_A_SMALLOBJECT
.PHONY: all clean
all: $(BIN1)
@ -15,8 +17,10 @@ $(BIN1): $(OBJ1) $(LIB1)
$(LIB1): $(OBJ2)
$(AR) $(ARFLAGS) $@ $^
clean:
clean: cleandeps
$(RM) $(BIN1)
$(RM) $(OBJ1)
$(RM) $(LIB1)
$(RM) $(OBJ2)
include ../../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = Test$(BIN_SUFFIX)
SRC = Test.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := Test$(BIN_SUFFIX)
SRC := Test.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,13 +1,17 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
override CXXFLAGS = $(CXXWARNFLAGS) -g -fexpensive-optimizations -O3
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
CXXFLAGS := $(CXXWARNFLAGS) -g -fexpensive-optimizations -O3
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,13 +1,15 @@
BIN1 = Dependencies$(BIN_SUFFIX)
SRC1 = Dependencies.cpp
OBJ1 = $(SRC1:.cpp=.o)
BIN2 = Phoenix$(BIN_SUFFIX)
SRC2 = Phoenix.cpp
OBJ2 = $(SRC2:.cpp=.o)
include ../Makefile.common
BIN1 := Dependencies$(BIN_SUFFIX)
SRC1 := Dependencies.cpp
OBJ1 := $(SRC1:.cpp=.o)
BIN2 := Phoenix$(BIN_SUFFIX)
SRC2 := Phoenix.cpp
OBJ2 := $(SRC2:.cpp=.o)
.PHONY: all clean
all: $(BIN1) $(BIN2)
clean:
clean: cleandeps
$(RM) $(BIN1)
$(RM) $(OBJ1)
$(RM) $(BIN2)
@ -18,3 +20,5 @@ $(BIN1): $(OBJ1)
$(BIN2): $(OBJ2)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,26 +1,29 @@
include ../Makefile.common
ifeq ($(OS),Darwin)
LIB1 = libfoo.dylib
LIB2 = libsingletondll.dylib
SHARED_LIB_FLAG = -dynamiclib
LIB1 := libfoo.dylib
LIB2 := libsingletondll.dylib
SHARED_LIB_FLAG := -dynamiclib
else
ifeq ($(OS),Linux)
LIB1 = libfoo.so
LIB2 = libsingletondll.so
SHARED_LIB_FLAG = --shared
LIB1 := libfoo.so
LIB2 := libsingletondll.so
SHARED_LIB_FLAG := --shared
else
LIB1 = foo.dll
LIB2 = singletondll.dll
SHARED_LIB_FLAG = --shared
LIB1 := foo.dll
LIB2 := singletondll.dll
SHARED_LIB_FLAG := --shared
endif
endif
BIN1 = client$(BIN_SUFFIX)
SRC1 = client.cpp
OBJ1 = $(SRC1:.cpp=.o)
SRC2 = foo.cpp
OBJ2 = $(SRC2:.cpp=.o)
SRC3 = singletondll.cpp
OBJ3 = $(SRC3:.cpp=.o)
BIN1 := client$(BIN_SUFFIX)
SRC1 := client.cpp
OBJ1 := $(SRC1:.cpp=.o)
SRC2 := foo.cpp
OBJ2 := $(SRC2:.cpp=.o)
SRC3 := singletondll.cpp
OBJ3 := $(SRC3:.cpp=.o)
override LDFLAGS := -L../../lib
.PHONY: all clean
all: $(BIN1)
@ -34,10 +37,12 @@ $(LIB1): $(OBJ2)
$(LIB2): $(OBJ3)
$(CXX) $(SHARED_LIB_FLAG) $(LDFLAGS) -L. -o $@ $^ -lfoo $(LDLIBS)
clean:
clean: cleandeps
$(RM) $(BIN1)
$(RM) $(OBJ1)
$(RM) $(LIB1)
$(RM) $(OBJ2)
$(RM) $(LIB2)
$(RM) $(OBJ3)
include ../../Makefile.deps

View file

@ -1,14 +1,16 @@
BIN1 = SmallObjBench$(BIN_SUFFIX)
SRC1 = SmallObjBench.cpp
OBJ1 = $(SRC1:.cpp=.o)
BIN2 = SmallObjSingleton$(BIN_SUFFIX)
SRC2 = SmallObjSingleton.cpp
OBJ2 = $(SRC2:.cpp=.o)
override CXXFLAGS = $(CXXWARNFLAGS) -g -fexpensive-optimizations -O3
include ../Makefile.common
BIN1 := SmallObjBench$(BIN_SUFFIX)
SRC1 := SmallObjBench.cpp
OBJ1 := $(SRC1:.cpp=.o)
BIN2 := SmallObjSingleton$(BIN_SUFFIX)
SRC2 := SmallObjSingleton.cpp
OBJ2 := $(SRC2:.cpp=.o)
CXXFLAGS := $(CXXWARNFLAGS) -g -fexpensive-optimizations -O3
.PHONY: all clean
all: $(BIN1) $(BIN2)
clean:
clean: cleandeps
$(RM) $(BIN1)
$(RM) $(OBJ1)
$(RM) $(BIN2)
@ -19,3 +21,5 @@ $(BIN1): $(OBJ1)
$(BIN2): $(OBJ2)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,17 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp strong.cpp LockTest.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp strong.cpp LockTest.cpp
OBJ := $(SRC:.cpp=.o)
LDLIBS += -lpthread
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,12 +1,16 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps

View file

@ -1,14 +1,16 @@
BIN = main$(BIN_SUFFIX)
SRC = main.cpp
OBJ = $(SRC:.cpp=.o)
override LDFLAGS =
override LDLIBS =
include ../Makefile.common
BIN := main$(BIN_SUFFIX)
SRC := main.cpp
OBJ := $(SRC:.cpp=.o)
.PHONY: all clean
all: $(BIN)
clean:
clean: cleandeps
$(RM) $(BIN)
$(RM) $(OBJ)
$(BIN): $(OBJ)
$(CXX) $(LDFLAGS) -o $@ $^ $(LDLIBS)
include ../../Makefile.deps