Get rid of string.c and string.h.
[osl.git] / Makefile
1 uname_s := $(shell uname -s 2>/dev/null || echo "UNKNOWN_OS")
2 uname_rs := $(shell uname -rs)
3
4 objects := osl.o fd.o rbtree.o sha1.o
5 major_version := 0
6 minor_version := 1
7 patchlevel_version := 0
8 libname := osl
9
10
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 endif
15 ifeq ($(uname_s),Darwin)
16 mac_major_version := $(shell expr 41 + $(major_version))
17 dso_opts := -dynamiclib -current_version $(major_version).$(minor_version) \
18 -compatibility_version $(major_version).$(minor_version) -fvisibility=hidden
19 dso_filename := lib$(libname).$(shell printf "\\x"$(mac_major_version).dylib)
20 endif
21 ifeq ($(uname_s),SunOS)
22 dso_opts := --shared -z text -z defs
23 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
24 CPPFLAGS += -I/opt/csw/include
25 endif
26 ifeq ($(uname_s),FreeBSD)
27 dso_opts := --shared -Wl,-soname,libosl.so.$(major_version)
28 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
29 endif
30 ifeq ($(uname_s),NetBSD)
31 dso_opts := --shared -Wl,-soname,libosl.so.$(major_version)
32 dso_filename :=lib$(libname).so.$(major_version).$(minor_version).$(patchlevel_version)
33 endif
34 all: $(dso_filename)
35
36 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
37 DEBUG_CPPFLAGS += -Wredundant-decls
38 #CPPFLAGS += -Os
39 CPPFLAGS += -Wall
40 #CPPFLAGS += -Wuninitialized
41 CPPFLAGS += -Wchar-subscripts
42 CPPFLAGS += -Wformat-security
43 CPPFLAGS += -Werror-implicit-function-declaration
44 CPPFLAGS += -Wmissing-format-attribute
45 CPPFLAGS += -Wunused-macros
46 CPPFLAGS += -Wbad-function-cast
47 CPPFLAGS += -fPIC
48
49 Makefile.deps: $(wildcard *.c *.h)
50 gcc -MM -MG *.c > $@
51
52 -include Makefile.deps
53
54 %.o: %.c Makefile
55 $(CC) -c $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
56 $(dso_filename): $(objects)
57 $(CC) $(dso_opts) -o $@ $(objects) -lcrypto
58
59 clean:
60 rm -f *.o $(dso_filename)