1 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
2 uname_rs := $(shell uname -rs)
4 objects := osl.o fd.o rbtree.o sha1.o
7 patchlevel_version := 0
11 ifeq ($(uname_s),Linux)
12 dso_opts := --shared -Wl,-soname,libosl.so.$(major_version)
13 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
14 # disallow undefined symbols
15 LDFLAGS += -Wl,-z,defs
17 ifeq ($(uname_s),Darwin)
18 # Darwin has its own idea on version numbers:
20 # The minor version number is an incremental number using the format
21 # X[.Y[.Z]]. To set the minor version number of a dynamic library, use
22 # the gcc -current_version option.
24 # The compatibility version number of a library release specifies the
25 # earliest minor version of the clients linked against that release can
27 dso_opts := -dynamiclib -current_version $(minor_version).$(patchlevel_version) \
28 -compatibility_version $(minor_version).0 -fvisibility=hidden
29 dso_filename := lib$(libname).$(major_version).dylib
31 ifeq ($(uname_s),SunOS)
32 dso_opts := --shared -z text -z defs
33 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
34 CPPFLAGS += -I/opt/csw/include
36 ifeq ($(uname_s),FreeBSD)
37 dso_opts := --shared -Wl,-soname,libosl.so.$(major_version)
38 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
40 ifeq ($(uname_s),NetBSD)
41 dso_opts := --shared -Wl,-soname,libosl.so.$(major_version)
42 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
46 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
47 DEBUG_CPPFLAGS += -Wredundant-decls
50 CPPFLAGS += -Wuninitialized
51 CPPFLAGS += -Wchar-subscripts
52 CPPFLAGS += -Wformat-security
53 CPPFLAGS += -Werror-implicit-function-declaration
54 CPPFLAGS += -Wmissing-format-attribute
55 CPPFLAGS += -Wunused-macros
56 CPPFLAGS += -Wbad-function-cast
58 CPPFLAGS += -fvisibility=hidden
60 Makefile.deps: $(wildcard *.c *.h)
63 -include Makefile.deps
66 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
67 $(dso_filename): $(objects)
68 $(CC) $(dso_opts) -o $@ $(objects) $(LDFLAGS) -lcrypto
71 sed -e 's/\([A-Z_]*\) .*/ E_OSL_\1/' \
72 -e '1s/^/enum osl_errors {\n/1' \
74 -e '$$s/$$/\n};/1' $< > $@
77 sed -e 's/^\([A-Z_]*\)\s*\(.*\)/_S(E_OSL_\1, \2)/g' $< > $@
78 osl.h: osl.h.in osl_errors.h
81 rm -f *.o $(dso_filename) osl.h osl_errors.h errtab.h