Imported File#ftype spec from rubyspecs.
[rbx.git] / shotgun / external_libs / libgdtoa / Makefile
blob47e687e7509ad741ec3f6e8162b0bd4df736fd2a
1 # Based on original makefile included with the source.
2 # The source for libgdtoa imported from FreeBSD 7.0
3 # in /usr/src/contrib/gdtoa.
5 -include ../../config.mk
7 # Respect the environment
8 ifeq ($(CC),)
9 CC=gcc
10 endif
12 UNAME=$(shell uname)
13 CPU=$(shell uname -p)
14 MARCH=$(shell uname -m)
15 OSVER=$(shell uname -r)
17 WARNINGS = -Wall
18 DEBUG = -g -ggdb3
20 CFLAGS = $(WARNINGS) $(DEBUG)
21 NAME=libgdtoa
22 VERSION = 1
23 COMP=$(CC)
24 RANLIB = ranlib
26 ifndef VERBOSE
27 COMP=@echo CC $@;$(CC)
28 LINKER=@echo LINK $@;$(CC) $(LDOPT)
29 endif
31 OUTPUT_A = $(NAME).a
33 ifeq ($(UNAME),Darwin)
34 SINGLE_MODULE=-Wl,-single_module
35 ifeq ($(OSVER),9.1.0)
36 export MACOSX_DEPLOYMENT_TARGET=10.5
37 else
38 export MACOSX_DEPLOYMENT_TARGET=10.4
39 endif
40 else
41 SINGLE_MODULE=
42 endif
44 ifeq ($(UNAME),SunOS)
45 CFLAGS+=-D__C99FEATURES__
46 endif
48 ifeq ($(UNAME),OpenBSD)
49 CFLAGS+=-DNO_FENV_H
50 endif
52 ifdef DEV
53 OPTIMIZATIONS=
54 else
55 INLINE_OPTS=
56 OPTIMIZATIONS=-O2 -funroll-loops -finline-functions $(INLINE_OPTS)
57 endif
59 ifeq ($(CPU), powerpc)
60 OPTIMIZATIONS+=-falign-loops=16
61 endif
63 CFLAGS += -fPIC $(CPPFLAGS)
65 DEPS = dmisc.c dtoa.c g_Qfmt.c g__fmt.c g_ddfmt.c g_dfmt.c g_ffmt.c\
66 g_xLfmt.c g_xfmt.c gdtoa.c gethex.c gmisc.c hd_init.c hexnan.c\
67 misc.c smisc.c strtoIQ.c strtoId.c strtoIdd.c strtoIf.c strtoIg.c\
68 strtoIx.c strtoIxL.c strtod.c strtodI.c strtodg.c strtof.c strtopQ.c\
69 strtopd.c strtopdd.c strtopf.c strtopx.c strtopxL.c strtorQ.c\
70 strtord.c strtordd.c strtorf.c strtorx.c strtorxL.c sum.c ulp.c
71 OBJS = dmisc.o dtoa.o g_Qfmt.o g__fmt.o g_ddfmt.o g_dfmt.o g_ffmt.o\
72 g_xLfmt.o g_xfmt.o gdtoa.o gethex.o gmisc.o hd_init.o hexnan.o\
73 misc.o smisc.o strtoIQ.o strtoId.o strtoIdd.o strtoIf.o strtoIg.o\
74 strtoIx.o strtoIxL.o strtod.o strtodI.o strtodg.o strtof.o strtopQ.o\
75 strtopd.o strtopdd.o strtopf.o strtopx.o strtopxL.o strtorQ.o\
76 strtord.o strtordd.o strtorf.o strtorx.o strtorxL.o sum.o ulp.o
78 all: arith.h gd_qnan.h library
80 arith.h: arithchk.c
81 $(CC) $(CFLAGS) arithchk.c || $(CC) -DNO_LONG_LONG $(CFLAGS) arithchk.c
82 ./a.out >arith.h
83 rm -f a.out arithchk.o
85 gd_qnan.h: arith.h qnan.c
86 $(CC) $(CFLAGS) qnan.c
87 ./a.out >gd_qnan.h
88 rm -f a.out qnan.o
90 %.o: %.c
91 $(COMP) $(CFLAGS) $(OPTIMIZATIONS) -c $< -o $@
93 %.o: %.S
94 $(COMP) $(CFLAGS) $(OPTIMIZATIONS) -c $< -o $@
96 .%.d: %.c $(DEPS)
97 @echo DEP $<
98 @set -e; rm -f $@; \
99 $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \
100 sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
101 rm -f $@.$$$$
103 library: $(OUTPUT_A)
105 $(OUTPUT_A): $(DEPS) $(OBJS)
106 $(AR) cru $(OUTPUT_A) $(OBJS)
107 $(RANLIB) $(OUTPUT_A)
109 .PHONY: library
111 test: library
112 -cd test; $(MAKE)
114 .PHONY: test
116 clean:
117 rm -f *.o *.lo *.la *.so *.a
118 -cd test; $(MAKE) clean
120 .PHONY: clean
122 ifneq ($(MAKECMDGOALS),clean)
123 -include $(SOURCES:%.c=.%.d)
124 endif