Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

software: add nofloat libbase for size-optimized binaries

  • Loading branch information...
commit d487dc607faf8568b52c8535eff7330a91250e11 1 parent fb6cd48
Sébastien Bourdeauducq authored May 19, 2013
2  software/bios/Makefile
@@ -22,7 +22,7 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
22 22
 		-L$(M2DIR)/software/libnet \
23 23
 		-L$(M2DIR)/software/libbase \
24 24
 		-L$(M2DIR)/software/libcompiler-rt \
25  
-		-lnet -lbase -lcompiler-rt
  25
+		-lnet -lbase-nofloat -lcompiler-rt
26 26
 	chmod -x $@
27 27
 
28 28
 main.o: main.c
8  software/common.mak
@@ -49,8 +49,8 @@ LDFLAGS = -nostdlib -nodefaultlibs
49 49
 # http://scottmcpeak.com/autodepend/autodepend.html
50 50
 
51 51
 define compilexx-dep
52  
-$(CX) -c $(CXXFLAGS) $< -o $*.o
53  
-@$(CX_normal) -MM $(CXXFLAGS) $< > $*.d
  52
+$(CX) -c $(CXXFLAGS) $(1) $< -o $*.o
  53
+@$(CX_normal) -MM $(CXXFLAGS) $(1) $< > $*.d
54 54
 @mv -f $*.d $*.d.tmp
55 55
 @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
56 56
 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
@@ -59,8 +59,8 @@ $(CX) -c $(CXXFLAGS) $< -o $*.o
59 59
 endef
60 60
 
61 61
 define compile-dep
62  
-$(CC) -c $(CFLAGS) $< -o $*.o
63  
-@$(CC_normal) -MM $(CFLAGS) $< > $*.d
  62
+$(CC) -c $(CFLAGS) $(1) $< -o $*.o
  63
+@$(CC_normal) -MM $(CFLAGS) $(1) $< > $*.d
64 64
 @mv -f $*.d $*.d.tmp
65 65
 @sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
66 66
 @sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
18  software/libbase/Makefile
... ...
@@ -1,17 +1,24 @@
1 1
 M2DIR=../..
2 2
 include $(M2DIR)/software/common.mak
3 3
 
4  
-OBJECTS=setjmp.o libc.o errno.o crc16.o crc32.o console.o system.o board.o uart.o vsnprintf.o strtod.o qsort.o
  4
+OBJECTS=setjmp.o libc.o errno.o crc16.o crc32.o console.o system.o board.o uart.o qsort.o strtod.o
5 5
 
6  
-all: libbase.a
  6
+all: libbase.a libbase-nofloat.a
7 7
 
8 8
 # pull in dependency info for *existing* .o files
9 9
 -include $(OBJECTS:.o=.d)
10 10
 
11  
-libbase.a: $(OBJECTS)
12  
-	$(AR) clr libbase.a $(OBJECTS)
  11
+libbase.a: $(OBJECTS) vsnprintf.o
  12
+	$(AR) clr libbase.a $(OBJECTS) vsnprintf.o
13 13
 	$(RANLIB) libbase.a
14 14
 
  15
+libbase-nofloat.a: $(OBJECTS) vsnprintf-nofloat.o
  16
+	$(AR) clr libbase-nofloat.a $(OBJECTS) vsnprintf-nofloat.o
  17
+	$(RANLIB) libbase-nofloat.a
  18
+
  19
+vsnprintf-nofloat.o: vsnprintf.c
  20
+	$(call compile-dep,-DNO_FLOAT)
  21
+
15 22
 %.o: %.c
16 23
 	$(compile-dep)
17 24
 
@@ -21,4 +28,5 @@ libbase.a: $(OBJECTS)
21 28
 .PHONY: clean
22 29
 
23 30
 clean:
24  
-	$(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libbase.a .*~ *~
  31
+	$(RM) $(OBJECTS) $(OBJECTS:.o=.d) vsnprintf.o vsnprintf.d vsnprintf-nofloat.o vsnprintf-nofloat.d
  32
+	$(RM) libbase.a libbase-nofloat.a .*~ *~
2  software/libbase/vsnprintf.c
@@ -192,6 +192,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
192 192
 						16, field_width, precision, flags);
193 193
 				continue;
194 194
 
  195
+#ifndef NO_FLOAT
195 196
 			case 'g':
196 197
 			case 'f': {
197 198
 				int m;
@@ -241,6 +242,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
241 242
 				
242 243
 				continue;
243 244
 			}
  245
+#endif
244 246
 
245 247
 			case 'n':
246 248
 				/* FIXME:

0 notes on commit d487dc6

Please sign in to comment.
Something went wrong with that request. Please try again.