1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Cleaned up the 68k build makefile, so that the CPU and FPU

tests and the error message display can run safely even
  on plain 68000 machines. This won't work for the 32 bit small
  data model, which implies 68020 code, but so there...


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14866 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-03-07 14:04:09 +00:00
parent ef43011783
commit d33e3e909e
5 changed files with 114 additions and 30 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.35 2005-03-07 11:16:42 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.36 2005-03-07 14:04:08 obarthel Exp $
#
# :ts=8
#
@ -77,23 +77,28 @@ $(LIBAMIGA_OBJS)/%.o : %.c
##############################################################################
ifeq (small_data_020,$(TYPE))
CODE_TYPE := -fbaserel -DSMALL_DATA -m68020-60 -DM68020
CODE_TYPE := -m68020-60 -fbaserel
CODE_FLAGS := -DSMALL_DATA -DM68020
endif
ifeq (small_data,$(TYPE))
CODE_TYPE := -fbaserel -DSMALL_DATA -m68000
CODE_TYPE := -m68000 -fbaserel
CODE_FLAGS := -DSMALL_DATA
endif
ifeq (small_data32,$(TYPE))
CODE_TYPE := -fbaserel32 -DSMALL_DATA32 -m68020-60 -DM68020
CODE_TYPE := -m68020-60 -fbaserel32
CODE_FLAGS := -DSMALL_DATA32 -DM68020
endif
ifeq (large_data_020,$(TYPE))
CODE_TYPE := -m68020-60 -DM68020
CODE_TYPE := -m68020-60
CODE_FLAGS := -DM68020
endif
ifeq (large_data,$(TYPE))
CODE_TYPE := -m68000
CODE_TYPE := -m68000
CODE_FLAGS :=
endif
##############################################################################
@ -112,7 +117,7 @@ INCLUDES = -Iinclude -I. -Inetinclude
#OPTIMIZE = -O2 -fomit-frame-pointer
#DEBUG = -g2
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDES)
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(CODE_TYPE) $(INCLUDES)
##############################################################################
@ -539,7 +544,6 @@ MATH_LIB = \
stdio_vsnprintf.o \
stdio_vsprintf.o \
stdlib_atof.o \
stdlib_machine_test.o \
stdlib_strtod.o \
time_difftime.o
@ -752,7 +756,7 @@ LIBS_020 := $(LIBM881_OBJS)/libm881.a $(LIBS_68K)
##############################################################################
# The 881 math library won't build in plain 68k mode
ifneq (,$(findstring 68020,$(CODE_TYPE)))
ifneq (,$(findstring 68020,$(CODE_FLAGS)))
LIBS := $(LIBS_020)
else
LIBS := $(LIBS_68K)
@ -943,6 +947,20 @@ $(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_mem_debug.h
##############################################################################
$(LIBC_OBJS)/stdlib_machine_test.o : stdlib_machine_test.c
@echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBC_OBJS)/stdlib_machine_test.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(INCLUDES) $<
$(LIBC_OBJS)/stdlib_showerror.o : stdlib_showerror.c
@echo "Compiling $< [$(TYPE):c]"
@$(CC) -o $(LIBC_OBJS)/stdlib_showerror.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(INCLUDES) $<
$(LIBM881_OBJS)/math_init_exit.o : math_init_exit.c
@echo "Compiling $< [$(TYPE):m881]"
@$(CC) -o $(LIBM881_OBJS)/math_init_exit.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_FLAGS) $(INCLUDES) -DM68881_FLOATING_POINT_SUPPORT $<
##############################################################################
$(LIBC_OBJS)/stdlib_alloca_debug.o : stdlib_alloca.c
@echo "Compiling $< [$(TYPE):c debug]"
@$(CC) -o $(LIBC_OBJS)/stdlib_alloca_debug.o -c $(CFLAGS) -D__USE_MEM_TREES -D__MEM_DEBUG stdlib_alloca.c
@ -1070,25 +1088,33 @@ $(LIBAMIGA_OBJS)/libamiga.a : $(LIBAMIGA_OBJS) $(foreach file,$(AMIGA_LIB),$(LIB
##############################################################################
nrcrt0.o : nrcrt0.S
$(CC) -traditional -o $@ -c nrcrt0.S
@echo "Assembling $< [resident]"
@$(CC) -traditional -o $@ -c nrcrt0.S
nr32crt0.o : nrcrt0.S
$(CC) -traditional -m68020 -DSMALL_DATA32 -o $@ -c nrcrt0.S
@echo "Assembling $< [resident32]"
@$(CC) -traditional -m68020 -DSMALL_DATA32 -o $@ -c nrcrt0.S
nbcrt0.o : ncrt0.S
$(CC) -traditional -DSMALL_DATA -o $@ -c ncrt0.S
@echo "Assembling $< [small_data]"
@$(CC) -traditional -DSMALL_DATA -o $@ -c ncrt0.S
nb32crt0.o : ncrt0.S
$(CC) -traditional -m68020 -DSMALL_DATA32 -o $@ -c ncrt0.S
@echo "Assembling $< [small_data32]"
@$(CC) -traditional -m68020 -DSMALL_DATA32 -o $@ -c ncrt0.S
ncrt0.o : ncrt0.S
$(CC) -traditional -o $@ -c ncrt0.S
@echo "Assembling $< [large_data]"
@$(CC) -traditional -o $@ -c ncrt0.S
mainb32.o : stdlib_main.c
$(CC) -o mainb32.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -fbaserel32 -DSMALL_DATA32 -m68020-60 -DM68020 stdlib_main.c
@echo "Compiling $< [small_data32]"
@$(CC) -o mainb32.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -fbaserel32 -DSMALL_DATA32 -m68020-60 -DM68020 stdlib_main.c
mainb.o : stdlib_main.c
$(CC) -o mainb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -fbaserel -DSMALL_DATA -m68000 stdlib_main.c
@echo "Compiling $< [small_data]"
@$(CC) -o mainb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -fbaserel -DSMALL_DATA -m68000 stdlib_main.c
mainnb.o : stdlib_main.c
$(CC) -o mainnb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -m68000 stdlib_main.c
@echo "Compiling $< [large_data]"
@$(CC) -o mainnb.o -c $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(INCLUDES) -m68000 stdlib_main.c

View File

@ -25,6 +25,11 @@
- Made the file descriptor checks in the fsync() and fdatasync()
functions more robust.
- Cleaned up the 68k build makefile, so that the CPU and FPU
tests and the error message display can run safely even
on plain 68000 machines. This won't work for the 32 bit small
data model, which implies 68020 code, but so there...
c.lib 1.189 (5.3.2005)

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_arg.c,v 1.1 2005-03-07 11:16:43 obarthel Exp $
* $Id: stdlib_arg.c,v 1.2 2005-03-07 14:04:09 obarthel Exp $
*
* :ts=4
*
@ -73,13 +73,13 @@ is_space(unsigned char c)
{
BOOL result;
result = (BOOL)(c == '\t' || /* tab */
c == '\r' || /* carriage return */
c == '\n' || /* line feed */
c == '\v' || /* vertical tab */
c == '\f' || /* form feed */
c == ' ' || /* blank space */
c == '\240'); /* non-breaking space */
result = (BOOL)(c == '\t' || /* horizontal tab */
c == '\r' || /* carriage return */
c == '\n' || /* line feed */
c == '\v' || /* vertical tab */
c == '\f' || /* form feed */
c == ' ' || /* blank space */
c == (unsigned char)'\240'); /* non-breaking space */
return(result);
}
@ -129,12 +129,12 @@ __arg_init(void)
feed and blank spaces if necessary. */
arg_str = GetArgStr();
while((*arg_str) == ' ' || (*arg_str) == '\t')
while(is_space(*arg_str))
arg_str++;
arg_len = strlen(arg_str);
while(arg_len > 0 && (arg_str[arg_len - 1] == '\n' || arg_str[arg_len - 1] == ' ' || arg_str[arg_len - 1] == '\t'))
while(arg_len > 0 && is_space(arg_str[arg_len - 1]))
arg_len--;
/* Make a copy of the shell parameter string. */
@ -315,6 +315,9 @@ __arg_init(void)
}
else
{
/* Return a pointer to the startup message in place of the
the argument vector. The argument counter (what will come
out as 'argc' for the main() function) will remain 0. */
__argv = (char **)__WBenchMsg;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_main.c,v 1.12 2005-03-07 11:16:43 obarthel Exp $
* $Id: stdlib_main.c,v 1.13 2005-03-07 14:04:09 obarthel Exp $
*
* :ts=4
*
@ -307,6 +307,7 @@ _main(void)
struct WBStartup * startup_message;
struct Process * this_process;
APTR old_window_pointer = NULL;
BOOL old_window_pointer_valid = FALSE;
int return_code = RETURN_FAIL;
ULONG current_stack_size;
int os_version;
@ -388,6 +389,8 @@ _main(void)
__set_process_window(old_window_pointer);
}
old_window_pointer_valid = TRUE;
/* If a callback was provided which can fill us in on which
minimum stack size should be used, invoke it now and
store its result in the global __stack_size variable. */
@ -557,7 +560,7 @@ _main(void)
out:
if(DOSBase != NULL)
if(old_window_pointer_valid)
__set_process_window(old_window_pointer);
if(child_process == NULL)

View File

@ -1,5 +1,5 @@
/*
* $Id: stdlib_showerror.c,v 1.9 2005-01-13 15:39:39 obarthel Exp $
* $Id: stdlib_showerror.c,v 1.10 2005-03-07 14:04:09 obarthel Exp $
*
* :ts=4
*
@ -68,6 +68,53 @@
/****************************************************************************/
#if NOT defined(__amigaos4__)
/****************************************************************************/
/* We use these short local versions of strlen() and bzero() so that this
module does not need to depend upon other library code which, so it happens,
might be built for the "wrong" CPU type. This is not a problem for the
PowerPC build, but it is for the 68k build. */
/****************************************************************************/
INLINE STATIC size_t
local_strlen(const char *s)
{
const char * start = s;
size_t result = 0;
while((*s) != '\0')
s++;
result = (size_t)(s - start);
return(result);
}
/****************************************************************************/
INLINE STATIC void
local_bzero(void *ptr, size_t len)
{
unsigned char * m = ptr;
while(len-- > 0)
(*m++) = 0;
}
/****************************************************************************/
#define strlen(s) local_strlen(s)
#define memset(ptr,val,len) local_bzero((ptr),(len))
/****************************************************************************/
#endif /* __amigaos4__ */
/****************************************************************************/
void
__show_error(const char * message)
{