aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-25 13:01:59 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-25 13:01:59 +0200
commit8f317590e6792d40af7fcfccdabd4a119c4d0b2d (patch)
tree669a963cad079d17e19e05b75b31ea4ee47f114a /Makefile
parentmore restrict (diff)
downloadlibgamma-8f317590e6792d40af7fcfccdabd4a119c4d0b2d.tar.gz
libgamma-8f317590e6792d40af7fcfccdabd4a119c4d0b2d.tar.bz2
libgamma-8f317590e6792d40af7fcfccdabd4a119c4d0b2d.tar.xz
m + add test that lists adjustment methds
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile44
1 files changed, 35 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 85fd74b..d11fffa 100644
--- a/Makefile
+++ b/Makefile
@@ -54,11 +54,13 @@ ifeq ($(DEBUG),y)
DEBUG_FLAGS += -D'DEBUG'
endif
-# Options for the C compiler.
-C_FLAGS = $(OPTIMISE) $(WARN) -std=$(STD) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
- -ftree-vrp -fstrict-aliasing -fipa-pure-const -fstack-usage \
- -fstrict-overflow -funsafe-loop-optimizations -fno-builtin \
- $(DEBUG_FLAGS) $(DEFINITIONS) -DLIBGAMMA_CONFIG_H
+# Options for the C compiler for the test.
+TEST_FLAGS = $(OPTIMISE) $(WARN) -std=$(STD) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \
+ -ftree-vrp -fstrict-aliasing -fipa-pure-const -fstack-usage \
+ -fstrict-overflow -funsafe-loop-optimizations -fno-builtin
+
+# Options for the C compiler for the library.
+LIB_FLAGS = $(TEST_FLAGS) $(DEBUG_FLAGS) $(DEFINITIONS) -DLIBGAMMA_CONFIG_H
# Library linking flags for the linker.
LIBS_LD =
@@ -68,6 +70,14 @@ LIBS_C =
# Object files for the library.
LIBOBJ = libgamma-facade libgamma-method libgamma-error gamma-helper edid
+# Object files for the test.
+TESTOBJ = test
+
+# The version of the library.
+LIB_MAJOR = 1
+LIB_MINOR = 0
+LIB_VERSION = $(LIB_MAJOR).$(LIB_MINOR)
+
# Include configurations from `./configure`.
include config.mk
@@ -77,16 +87,32 @@ include config.mk
# Build rules.
.PHONY: all
-all: bin/libgamma.so
+all: bin/libgamma.so.$(LIB_VERSION) bin/libgamma.so.$(LIB_MAJOR) bin/libgamma.so bin/test
-bin/libgamma.so: $(foreach O,$(LIBOBJ),obj/$(O).o)
+bin/libgamma.so.$(LIB_VERSION): $(foreach O,$(LIBOBJ),obj/$(O).o)
mkdir -p $(shell dirname $@)
- $(CC) $(C_FLAGS) $(LIBS_LD) -shared -o $@ $^
+ $(CC) $(LIB_FLAGS) $(LIBS_LD) -shared -Wl,-soname,libgamma.so.$(LIB_MAJOR) -o $@ $^
+
+bin/libgamma.so.$(LIB_MAJOR):
+ mkdir -p $(shell dirname $@)
+ ln -s libgamma.so.$(LIB_VERSION) $@
+
+bin/libgamma.so:
+ mkdir -p $(shell dirname $@)
+ ln -s libgamma.so.$(LIB_VERSION) $@
obj/%.o: src/%.c src/*.h
mkdir -p $(shell dirname $@)
- $(CC) $(C_FLAGS) $(LIBS_C) -fPIC -c -o $@ $<
+ $(CC) $(LIB_FLAGS) $(LIBS_C) -fPIC -c -o $@ $<
+
+bin/test: $(foreach O,$(TESTOBJ),obj/$(O).o) bin/libgamma.so.$(LIB_VERSION) bin/libgamma.so
+ mkdir -p $(shell dirname $@)
+ $(CC) $(TEST_FLAGS) $(LIBS_LD) -Lbin -lgamma -o $@ $(foreach O,$(TESTOBJ),obj/$(O).o)
+
+obj/%.o: test/%.c
+ mkdir -p $(shell dirname $@)
+ $(CC) $(TEST_FLAGS) -Isrc -c -o $@ $<
# Clean rules.