Imported File#ftype spec from rubyspecs.
[rbx.git] / shotgun / external_libs / libbstring / Makefile
blob51122834d6a94d0979f9f212e950d3112c65a0fd
1 -include ../../config.mk
3 # Respect the environment
4 ifeq ($(CC),)
5 CC=gcc
6 endif
8 UNAME=$(shell uname)
9 CPU=$(shell uname -p)
10 MARCH=$(shell uname -m)
11 OSVER=$(shell uname -r)
13 WARNINGS = -Wall
14 DEBUG = -g -ggdb3
16 CFLAGS = $(WARNINGS) $(DEBUG)
18 COMP=$(CC)
19 ifeq ($(UNAME),Darwin)
20 LDOPT=-dynamiclib
21 SUFFIX=dylib
22 SONAME=-current_version $(VERSION) -compatibility_version $(VERSION)
23 else
24 SUFFIX=so
25 LDOPT=-shared
26 ifneq ($(UNAME),SunOS)
27 SONAME=-Wl,-soname,libbstrings-$(VERSION).$(SUFFIX)
28 endif
29 endif
31 BIN_RPATH=
32 LINKER = $(CC) $(LDOPT)
33 RANLIB = ranlib
35 ifndef VERBOSE
36 COMP=@echo CC $@;$(CC)
37 LINKER=@echo LINK $@;$(CC) $(LDOPT)
38 endif
40 VERSION=0.32
42 OUTPUT_LIB=libbstring.$(VERSION).$(SUFFIX)
43 OUTPUT_A=libbstring.a
45 ifeq ($(UNAME),Darwin)
46 SINGLE_MODULE=-Wl,-single_module
47 ifeq ($(OSVER),9.1.0)
48 export MACOSX_DEPLOYMENT_TARGET=10.5
49 else
50 export MACOSX_DEPLOYMENT_TARGET=10.4
51 endif
52 else
53 SINGLE_MODULE=
54 endif
56 ifeq ($(UNAME),SunOS)
57 CFLAGS+=-D__C99FEATURES__
58 endif
60 ifdef DEV
61 OPTIMIZATIONS=
62 else
63 INLINE_OPTS=
64 OPTIMIZATIONS=-O2 -funroll-loops -finline-functions $(INLINE_OPTS)
65 endif
67 ifeq ($(CPU), powerpc)
68 OPTIMIZATIONS+=-falign-loops=16
69 endif
71 CFLAGS += -fPIC $(CPPFLAGS)
72 DEPS=bstraux.h bstrlib.h
74 SOURCES=bstraux.c bstrlib.c
75 OBJS=$(SOURCES:.c=.o)
77 %.o: %.c
78 $(COMP) $(CFLAGS) $(OPTIMIZATIONS) -c $< -o $@
80 %.o: %.S
81 $(COMP) $(CFLAGS) $(OPTIMIZATIONS) -c $< -o $@
83 .%.d: %.c $(DEPS)
84 @echo DEP $<
85 @set -e; rm -f $@; \
86 $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
87 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
88 rm -f $@.$$$$
90 library: $(OUTPUT_LIB) $(OUTPUT_A)
92 $(OUTPUT_LIB): $(DEPS) $(OBJS)
93 $(LINKER) -o $(OUTPUT_LIB) $(OBJS) $(SONAME) $(LIBS)
95 $(OUTPUT_A): $(DEPS) $(OBJS)
96 $(AR) cru $(OUTPUT_A) $(OBJS)
97 $(RANLIB) $(OUTPUT_A)
99 .PHONY: library
101 clean:
102 rm -f *.o *.lo *.la *.so *.dylib *.a
104 .PHONY: clean
106 ifneq ($(MAKECMDGOALS),clean)
107 -include $(SOURCES:%.c=.%.d)
108 endif