Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

software: add nofloat libbase for size-optimized binaries

  • Loading branch information...
commit d487dc607faf8568b52c8535eff7330a91250e11 1 parent fb6cd48
@sbourdeauducq sbourdeauducq authored
View
2  software/bios/Makefile
@@ -22,7 +22,7 @@ bios-rescue.elf: linker-rescue.ld $(OBJECTS) libs
-L$(M2DIR)/software/libnet \
-L$(M2DIR)/software/libbase \
-L$(M2DIR)/software/libcompiler-rt \
- -lnet -lbase -lcompiler-rt
+ -lnet -lbase-nofloat -lcompiler-rt
chmod -x $@
main.o: main.c
View
8 software/common.mak
@@ -49,8 +49,8 @@ LDFLAGS = -nostdlib -nodefaultlibs
# http://scottmcpeak.com/autodepend/autodepend.html
define compilexx-dep
-$(CX) -c $(CXXFLAGS) $< -o $*.o
-@$(CX_normal) -MM $(CXXFLAGS) $< > $*.d
+$(CX) -c $(CXXFLAGS) $(1) $< -o $*.o
+@$(CX_normal) -MM $(CXXFLAGS) $(1) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
@@ -59,8 +59,8 @@ $(CX) -c $(CXXFLAGS) $< -o $*.o
endef
define compile-dep
-$(CC) -c $(CFLAGS) $< -o $*.o
-@$(CC_normal) -MM $(CFLAGS) $< > $*.d
+$(CC) -c $(CFLAGS) $(1) $< -o $*.o
+@$(CC_normal) -MM $(CFLAGS) $(1) $< > $*.d
@mv -f $*.d $*.d.tmp
@sed -e 's|.*:|$*.o:|' < $*.d.tmp > $*.d
@sed -e 's/.*://' -e 's/\\$$//' < $*.d.tmp | fmt -1 | \
View
18 software/libbase/Makefile
@@ -1,17 +1,24 @@
M2DIR=../..
include $(M2DIR)/software/common.mak
-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
+OBJECTS=setjmp.o libc.o errno.o crc16.o crc32.o console.o system.o board.o uart.o qsort.o strtod.o
-all: libbase.a
+all: libbase.a libbase-nofloat.a
# pull in dependency info for *existing* .o files
-include $(OBJECTS:.o=.d)
-libbase.a: $(OBJECTS)
- $(AR) clr libbase.a $(OBJECTS)
+libbase.a: $(OBJECTS) vsnprintf.o
+ $(AR) clr libbase.a $(OBJECTS) vsnprintf.o
$(RANLIB) libbase.a
+libbase-nofloat.a: $(OBJECTS) vsnprintf-nofloat.o
+ $(AR) clr libbase-nofloat.a $(OBJECTS) vsnprintf-nofloat.o
+ $(RANLIB) libbase-nofloat.a
+
+vsnprintf-nofloat.o: vsnprintf.c
+ $(call compile-dep,-DNO_FLOAT)
+
%.o: %.c
$(compile-dep)
@@ -21,4 +28,5 @@ libbase.a: $(OBJECTS)
.PHONY: clean
clean:
- $(RM) $(OBJECTS) $(OBJECTS:.o=.ts) $(OBJECTS:.o=.d) libbase.a .*~ *~
+ $(RM) $(OBJECTS) $(OBJECTS:.o=.d) vsnprintf.o vsnprintf.d vsnprintf-nofloat.o vsnprintf-nofloat.d
+ $(RM) libbase.a libbase-nofloat.a .*~ *~
View
2  software/libbase/vsnprintf.c
@@ -192,6 +192,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
16, field_width, precision, flags);
continue;
+#ifndef NO_FLOAT
case 'g':
case 'f': {
int m;
@@ -241,6 +242,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
continue;
}
+#endif
case 'n':
/* FIXME:
Please sign in to comment.
Something went wrong with that request. Please try again.