tgmath fixes, better return type handling
[libm] / Makefile
1 SRCS = $(sort $(wildcard src/*/*.c))
2 OBJS = $(SRCS:.c=.o)
3
4 CFLAGS  = -Os -ffloat-store -nostdinc -ffreestanding -std=c99 -D_XOPEN_SOURCE=700 -pipe
5 INC     = -I./include -I./src/internal -I./arch/$(ARCH)
6 AR      = $(CROSS_COMPILE)ar
7 RANLIB  = $(CROSS_COMPILE)ranlib
8 OBJCOPY = $(CROSS_COMPILE)objcopy
9
10 STATIC_LIBS = lib/libm.a
11 ALL_LIBS = $(STATIC_LIBS)
12
13 -include config.mak
14
15 all: $(ALL_LIBS)
16
17 clean:
18         rm -f $(OBJS)
19         rm -f $(ALL_LIBS) lib/*.[ao] lib/*.so
20         rm -f include/bits
21
22 include/bits:
23         @test "$(ARCH)" || { echo "Please set ARCH in config.mak before running make." ; exit 1 ; }
24         ln -sf ../arch/$(ARCH)/bits $@
25
26 include/bits/alltypes.h.sh: include/bits
27
28 include/bits/alltypes.h: include/bits/alltypes.h.sh
29         sh $< > $@
30
31 %.o: $(ARCH)/%.s
32         $(CC) $(CFLAGS) $(INC) -c -o $@ $<
33
34 %.o: %.c include/bits/alltypes.h
35         $(CC) $(CFLAGS) $(INC) -c -o $@ $<
36
37 lib/libm.a: $(OBJS)
38         rm -f $@
39         $(AR) rc $@ $(OBJS)
40         $(RANLIB) $@