]> git.tuebingen.mpg.de Git - osl.git/blobdiff - Makefile
Makefile: Activate optimization and -Wuninitialized.
[osl.git] / Makefile
index 70b83c70f9055846cd07aa7ddcc331fbf62e9497..6350b8eccba228c2185f267c5b1158df6b6bc9ea 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
@@ -55,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