]> git.tuebingen.mpg.de Git - osl.git/blobdiff - Makefile
Makefile: Activate optimization and -Wuninitialized.
[osl.git] / Makefile
index e79390c4ddad37f9d93c624f84c2ecc1984e98c3..6350b8eccba228c2185f267c5b1158df6b6bc9ea 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
 uname_rs := $(shell uname -rs)
 
-objects := osl.o fd.o rbtree.o string.o sha1.o
+objects := osl.o fd.o rbtree.o sha1.o
 major_version := 0
 minor_version := 1
 patchlevel_version := 0
@@ -33,11 +33,14 @@ ifeq ($(uname_s),NetBSD)
 endif
 all: $(dso_filename)
 
+# disallow undefined symbols
+LDFLAGS += -Wl,-z,defs
+
 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
 DEBUG_CPPFLAGS += -Wredundant-decls
-#CPPFLAGS += -Os
+CPPFLAGS += -Os
 CPPFLAGS += -Wall
-#CPPFLAGS += -Wuninitialized
+CPPFLAGS += -Wuninitialized
 CPPFLAGS += -Wchar-subscripts
 CPPFLAGS += -Wformat-security
 CPPFLAGS += -Werror-implicit-function-declaration
@@ -45,6 +48,7 @@ CPPFLAGS += -Wmissing-format-attribute
 CPPFLAGS += -Wunused-macros
 CPPFLAGS += -Wbad-function-cast
 CPPFLAGS += -fPIC
+CPPFLAGS += -fvisibility=hidden
 
 Makefile.deps: $(wildcard *.c *.h)
        gcc -MM -MG *.c > $@
@@ -54,7 +58,17 @@ Makefile.deps: $(wildcard *.c *.h)
 %.o: %.c Makefile
        $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
 $(dso_filename): $(objects)
-       $(CC) $(dso_opts) -o $@ $(objects) -lcrypto
+       $(CC) $(dso_opts) -o $@ $(objects) $(LDFLAGS) -lcrypto
+
+osl_errors.h: errlist
+       sed -e 's/\([A-Z_]*\)   .*/     E_OSL_\1/' \
+               -e '1s/^/enum osl_errors {\n/1' \
+               -e '$$!s/$$/,/g' \
+               -e '$$s/$$/\n};/1' $< > $@
 
+errtab.h: errlist
+       sed -e 's/^\([A-Z_]*\)\s*\(.*\)/_S(E_OSL_\1, \2)/g' $< > $@
+osl.h: osl.h.in osl_errors.h
+       cat $^ > $@
 clean:
-       rm -f *.o $(dso_filename)
+       rm -f *.o $(dso_filename) osl.h osl_errors.h errtab.h