diff --git a/cross.mk b/cross.mk old mode 100644 new mode 100755 index f0eb9a2..8dec173 --- a/cross.mk +++ b/cross.mk @@ -18,6 +18,14 @@ TAGSFILE = tags MANROFF = nroff -man -h ELF2AOUT = cp -CFLAGS = -O -DCROSS -I/usr/include -I$(TOPSRC)/include +CFLAGS = -O -DCROSS LDFLAGS = LIBS = + +# Add system include path +ifeq (,$(wildcard /usr/include/i386-linux-gnu)) + CFLAGS += -I/usr/include +else + CFLAGS += -I/usr/include/i386-linux-gnu +endif +CFLAGS += -I$(TOPSRC)/include diff --git a/lib/Makefile b/lib/Makefile old mode 100644 new mode 100755 index ddf9cc2..e821099 --- a/lib/Makefile +++ b/lib/Makefile @@ -5,9 +5,15 @@ PROG = ar as aout ld nm ranlib size strip # Build a list of the host include directories. CPP = $(shell gcc -print-prog-name=cc1) HOSTINC = $(addprefix -I,$(shell echo | $(CPP) -v 2>&1 | grep '^ /.*include')) -HOSTINC += -I/usr/include/i386-linux-gnu -CFLAGS += -nostdinc -g -Werror -Wall -DCROSS -I. $(HOSTINC) \ +# Add system include path +ifeq (,$(wildcard /usr/include/i386-linux-gnu)) + HOSTINC += -I/usr/include +else + HOSTINC += -I/usr/include/i386-linux-gnu +endif + +CFLAGS += -nostdinc -fno-builtin -g -Werror -Wall -DCROSS -I. $(HOSTINC) \ -I$(TOPSRC)/include -I$(TOPSRC)/src/cmd/ar \ -I$(TOPSRC)/src/cmd/as LDFLAGS += -g diff --git a/src/libc/compat/Makefile b/src/libc/compat/Makefile old mode 100644 new mode 100755 index 548f084..917649e --- a/src/libc/compat/Makefile +++ b/src/libc/compat/Makefile @@ -6,7 +6,7 @@ TOPSRC = $(shell cd ../../..; pwd) include $(TOPSRC)/target.mk -CFLAGS += ${DEFS} +CFLAGS += ${DEFS} -Os SRCS = creat.c ftime.c gethostid.c gtty.c memccpy.c memchr.c memcmp.c \ memcpy.c memset.c nice.c pause.c rand.c sethostid.c \ diff --git a/src/libc/gen/Makefile b/src/libc/gen/Makefile old mode 100644 new mode 100755 index 0dd687b..933e2af --- a/src/libc/gen/Makefile +++ b/src/libc/gen/Makefile @@ -6,7 +6,7 @@ TOPSRC = $(shell cd ../../..; pwd) include $(TOPSRC)/target.mk -CFLAGS += ${DEFS} +CFLAGS += ${DEFS} -Os -Wall -Werror SRCS = ${STDSRC} OBJS = ${STDOBJ} @@ -36,7 +36,7 @@ STDOBJ = abort.o alarm.o atof.o atoi.o atol.o calloc.o closedir.o crypt.o \ getpass.o getpwent.o getloadavg.o getmntinfo.o \ getttyent.o getttynam.o getusershell.o getwd.o \ initgroups.o isatty.o isinff.o isnanf.o ldexp.o malloc.o mktemp.o \ - modff.o modf.o ndbm.o nlist.o knlist.o opendir.o perror.o popen.o \ + modff.o modf.c ndbm.o nlist.o knlist.o opendir.o perror.o popen.o \ psignal.o qsort.o random.o readdir.o regex.o scandir.o \ seekdir.o setmode.o sethostname.o setenv.o siglist.o \ signal.o siginterrupt.o sigsetops.o \ diff --git a/src/libc/gen/ndbm.c b/src/libc/gen/ndbm.c old mode 100644 new mode 100755 index 071bcd3..70447df --- a/src/libc/gen/ndbm.c +++ b/src/libc/gen/ndbm.c @@ -465,7 +465,7 @@ dbm_nextkey(db) db->dbm_flags |= _DBM_IOERR; #endif } - if (((short *)db->dbm_pagbuf)[0] != 0) { + if (db->dbm_pagbuf[0] != 0 && db->dbm_pagbuf[1] != 0) { item = makdatum(db->dbm_pagbuf, db->dbm_keyptr); if (item.dptr != NULL) { db->dbm_keyptr += 2; diff --git a/src/libc/mips/sys/Makefile b/src/libc/mips/sys/Makefile old mode 100644 new mode 100755 index dcf8622..a513cdb --- a/src/libc/mips/sys/Makefile +++ b/src/libc/mips/sys/Makefile @@ -2,6 +2,7 @@ TOPSRC = $(shell cd ../../../..; pwd) include $(TOPSRC)/target.mk ASFLAGS += ${DEFS} +CFLAGS += -Os # modules which can not use SYSCALL and must be assembled from sources. The # rest of the system calls are generated with printf(1) and do not have diff --git a/src/libc/stdio/Makefile b/src/libc/stdio/Makefile old mode 100644 new mode 100755 index 796d33b..4238c6d --- a/src/libc/stdio/Makefile +++ b/src/libc/stdio/Makefile @@ -6,7 +6,7 @@ TOPSRC = $(shell cd ../../..; pwd) include $(TOPSRC)/target.mk -CFLAGS += ${DEFS} +CFLAGS += ${DEFS} -Os SRCS = ${STDSRC} fgetc.c fgets.c fputc.c fputs.c gets.c puts.c \ feof.c ferror.c fileno.c diff --git a/src/libc/stdlib/Makefile b/src/libc/stdlib/Makefile old mode 100644 new mode 100755 index 2a6e09d..952f211 --- a/src/libc/stdlib/Makefile +++ b/src/libc/stdlib/Makefile @@ -7,7 +7,7 @@ TOPSRC = $(shell cd ../../..; pwd) include $(TOPSRC)/target.mk DEFS = -CFLAGS += ${DEFS} +CFLAGS += ${DEFS} -Os SRCS = getopt.c getsubopt.c strtol.c strtoul.c strtod.c OBJS = getopt.o getsubopt.o strtol.o strtoul.o strtod.o diff --git a/sys/kernel/kern_exec.c b/sys/kernel/kern_exec.c old mode 100644 new mode 100755 index f7f6e13..18cfbbf --- a/sys/kernel/kern_exec.c +++ b/sys/kernel/kern_exec.c @@ -405,12 +405,8 @@ again: bdwrite (bp); } bp = 0; - // ###PITO nc = (nc + NBPW-1) & ~(NBPW-1); getxfile (ip, &exdata.ex_exec, nc + (na+4)*NBPW, uid, gid); - //nc = (nc + (NBPW*2)-1) & ~((NBPW*2)-1); - //getxfile (ip, &exdata.ex_exec, nc + (na+4)*(NBPW*2), uid, gid); - // ###PITO if (u.u_error) { //printf ("execve: getxfile error = %d\n", u.u_error); badarg: diff --git a/sys/pic32/gcc-config.mk b/sys/pic32/gcc-config.mk old mode 100644 new mode 100755 index aae0bcb..d026bc4 --- a/sys/pic32/gcc-config.mk +++ b/sys/pic32/gcc-config.mk @@ -1,3 +1,11 @@ +# chipKIT PIC32 compiler from UECIDE +ifdef UECIDE +ifndef GCCPREFIX + GCCPREFIX = ${HOME}/.uecide/compilers/pic32-tools/bin/pic32- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips +endif +endif + # chipKIT PIC32 compiler on Linux # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Download from https://github.com/jasonkajita/chipKIT-cxx/downloads diff --git a/sys/pic32/kernel-post.mk b/sys/pic32/kernel-post.mk old mode 100644 new mode 100755 index acbae77..b73fd0e --- a/sys/pic32/kernel-post.mk +++ b/sys/pic32/kernel-post.mk @@ -73,7 +73,7 @@ vers.o: $(BUILDPATH)/newvers.sh $(H)/*.h $(M)/*.[ch] $(S)/*.c $(CC) -c vers.c reconfig: - $(CONFIGPATH)/config $(CONFIG) + ../../../tools/configsys/config $(CONFIG) .SUFFIXES: .i .srec .hex .dis .cpp .cxx .bin .elf diff --git a/target.mk b/target.mk old mode 100644 new mode 100755 index 987d679..816b10f --- a/target.mk +++ b/target.mk @@ -1,6 +1,15 @@ MACHINE = mips DESTDIR ?= $(TOPSRC) +# chipKIT PIC32 compiler from UECIDE +ifdef UECIDE +ifndef GCCPREFIX + GCCPREFIX = ${HOME}/.uecide/compilers/pic32-tools/bin/pic32- + LDFLAGS = -Wl,--oformat=elf32-tradlittlemips + INCLUDES = -I${HOME}/.uecide/compilers/pic32-tools/lib/gcc/pic32mx/4.5.1/include +endif +endif + # chipKIT PIC32 compiler on Linux # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # Download from https://github.com/jasonkajita/chipKIT-cxx/downloads @@ -26,7 +35,7 @@ ifndef GCCPREFIX endif CC = $(GCCPREFIX)gcc -mips32r2 -EL -msoft-float -nostdinc -fno-short-double -I$(TOPSRC)/include $(INCLUDES) -CXX = $(GCCPREFIX)g++ -mips32r2 -EL -msoft-float -nostdinc -fno-short-double -I$(TOPSRC)/include $(INCLUDES) +CXX = $(GCCPREFIX)g++ -mips32r2 -EL -msoft-float -nostdinc -fno-short-double -I$(TOPSRC)/include $(INCLUDES) LD = $(GCCPREFIX)ld AR = $(GCCPREFIX)ar RANLIB = $(GCCPREFIX)ranlib