Changeset 3820


Ignore:
Timestamp:
Feb 26, 2014, 1:44:45 AM (11 years ago)
Author:
bird
Message:

Slowly starting to make it build with non GCC compilers, first out is OpenWatcom.

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified trunk/Config.kmk

    r3665 r3820  
    11# $Id$
    22## @file
    3 #
    43# Top-level kBuild configuration.
    54#
    6 # Copyright (c) 2006 knut st. osmundsen <bird@anduin.net>
     5
     6#
     7# Copyright (c) 2006-2014 knut st. osmundsen <bird@anduin.net>
    78#
    89#
     
    3738
    3839#
     40# Base template.
     41#
     42TEMPLATE_kNIX-base = Base template.
     43ifdef CFG_USE_WATCOM
     44 TEMPLATE_kNIX-base_TOOL = OPENWATCOM
     45 TEMPLATE_kNIX-base_CFLAGS = -za99
     46else
     47 TEMPLATE_kNIX-base_TOOL = GCC3
     48 TEMPLATE_kNIX-base_TOOL.os2 = GCC3OMF
     49endif
     50
     51
     52#
    3953# The /bin templates.
    4054#
    4155TEMPLATE_bin = /bin/ programs.
    42 TEMPLATE_bin_TOOL = GCC3
    43 TEMPLATE_bin_TOOL.os2 = GCC3OMF
     56TEMPLATE_bin_EXTENDS = kNIX-base
    4457TEMPLATE_bin_INST = bin/
    4558
     
    4861#
    4962TEMPLATE_usr.bin = /usr/bin/ programs.
    50 TEMPLATE_usr.bin_TOOL = GCC3
    51 TEMPLATE_usr.bin_TOOL.os2 = GCC3OMF
     63TEMPLATE_usr.bin_EXTENDS = kNIX-base
    5264TEMPLATE_usr.bin_INST = usr/bin/
    5365
     
    6678
    6779TEMPLATE_usr.bin.alp = /usr/bin/ libraries using alp as assembler.
    68 TEMPLATE_usr.bin.alp_TOOL = GCC3
    69 TEMPLATE_usr.bin.alp_TOOL.os2 = GCC3OMF
     80TEMPLATE_usr.bin.alp_EXTENDS = kNIX-base
    7081TEMPLATE_usr.bin.alp_ASTOOL = ALP
    7182TEMPLATE_usr.bin.alp_ASFLAGS = -Sv:ALP
     
    7384
    7485TEMPLATE_usr.bin.nasm = /usr/lib/ libraries using nasm as assembler.
    75 TEMPLATE_usr.bin.nasm_TOOL = GCC3
    76 TEMPLATE_usr.bin.nasm_TOOL.os2 = GCC3OMF
     86TEMPLATE_usr.bin.nasm_EXTENDS = kNIX-base
    7787TEMPLATE_usr.bin.nasm_ASTOOL = NASM
    7888TEMPLATE_usr.bin.nasm_ASFLAGS = -f obj
     
    8393#
    8494TEMPLATE_usr.sbin = /usr/sbin/ programs.
    85 TEMPLATE_usr.sbin_TOOL = GCC3
    86 TEMPLATE_usr.sbin_TOOL.os2 = GCC3OMF
     95TEMPLATE_usr.sbin_EXTENDS = kNIX-base
    8796TEMPLATE_usr.sbin_INST = usr/sbin/
    8897
     
    117126#
    118127TEMPLATE_usr.lib = /usr/lib/ libraries.
    119 TEMPLATE_usr.lib_TOOL = GCC3
    120 TEMPLATE_usr.lib_TOOL.os2 = GCC3OMF
     128TEMPLATE_usr.lib_EXTENDS = kNIX-base
    121129TEMPLATE_usr.lib_INST = usr/lib/
    122130TEMPLATE_usr.lib_MODE = 644
    123131
    124132TEMPLATE_usr.lib.nasm = /usr/lib/ libraries using nasm as assembler.
    125 TEMPLATE_usr.lib.nasm_TOOL = GCC3
    126 TEMPLATE_usr.lib.nasm_TOOL.os2 = GCC3OMF
     133TEMPLATE_usr.lib.nasm_EXTENDS = kNIX-base
    127134TEMPLATE_usr.lib.nasm_ASTOOL = NASM
    128135TEMPLATE_usr.lib.nasm_ASFLAGS = -f obj
  • TabularUnified trunk/libc/Config.kmk

    r3629 r3820  
    6060#
    6161PATH_LIBC_ROOT = $(PATH_ROOT)/libc
    62 PATH_LIBC_SRC = $(PATH_LIBC_ROOT)/src
    63 PATH_LIBC_INC = $(PATH_LIBC_ROOT)/include
     62PATH_LIBC_SRC  = $(PATH_LIBC_ROOT)/src
     63PATH_LIBC_INC  = $(PATH_LIBC_ROOT)/include
     64
    6465LIBC-STD.H = $(PATH_OBJ)/libc/libc-std.h
    6566LIBC_GENALIAS = $(PATH_TARGET)/genalias/genalias$(HOSTSUFF_EXE)
    6667LIBC_GENALIAS_FORMAT.nt = coff
    6768ifdef LIBC_GENALIAS_FORMAT.$(BUILD_TARGET)
    68 LIBC_GENALIAS_FORMAT := $(LIBC_GENALIAS_FORMAT.$(BUILD_TARGET))
    69 else
    70 LIBC_GENALIAS_FORMAT := aout
     69 LIBC_GENALIAS_FORMAT := $(LIBC_GENALIAS_FORMAT.$(BUILD_TARGET))
     70else
     71 LIBC_GENALIAS_FORMAT := aout
    7172endif
    7273
     
    7475# Templates
    7576#
    76 TEMPLATE_libc = libc template
    77 TEMPLATE_libc_TOOL = GCC3
     77TEMPLATE_libc = libc template
     78TEMPLATE_libc_DEPS = $(LIBC-STD.H)
     79TEMPLATE_libc_INST = usr/lib/
    7880TEMPLATE_libc_INCS = $(PATH_LIBC_INC) $(dir $(LIBC-STD.H))
    7981TEMPLATE_libc_INCS.nt = $(PATH_LIBC_SRC)/w32api/include
    80 TEMPLATE_libc_DEPS = $(LIBC-STD.H)
    81 TEMPLATE_libc_INST = usr/lib/
    82 TEMPLATE_libc_CFLAGS = $(TEMPLATE_lib_CFLAGS) -std=gnu99 -Wall -Wundef -Wmissing-prototypes
    83 TEMPLATE_libc_CFLAGS.os2 = $(TEMPLATE_lib_CFLAGS.os2) -mstack-arg-probe
    84 TEMPLATE_libc_CFLAGS.release = $(TEMPLATE_lib_CFLAGS.release) -O3 -mcpu=pentium
     82if defined(CFG_LIBC_USE_WATCOM) || defined(CFG_KNIX_USE_WATCOM)
     83 TEMPLATE_libc_TOOL = OPENWATCOM
     84 TEMPLATE_libc_CFLAGS = $(TEMPLATE_lib_CFLAGS)
     85 TEMPLATE_libc_CFLAGS.os2 = $(TEMPLATE_lib_CFLAGS.os2)
     86 TEMPLATE_libc_CFLAGS.release = $(TEMPLATE_lib_CFLAGS.release)
     87else
     88 TEMPLATE_libc_TOOL = GCC3
     89 TEMPLATE_libc_CFLAGS = $(TEMPLATE_lib_CFLAGS) -std=gnu99 -Wall -Wundef -Wmissing-prototypes
     90 TEMPLATE_libc_CFLAGS.os2 = $(TEMPLATE_lib_CFLAGS.os2) -mstack-arg-probe
     91 TEMPLATE_libc_CFLAGS.release = $(TEMPLATE_lib_CFLAGS.release) -O3 -mcpu=pentium
     92endif
    8593
    8694TEMPLATE_libc.logstrict = .
     
    110118
    111119TEMPLATE_libcasm = .
    112 TEMPLATE_libcasm_TOOL = GCC3
    113 TEMPLATE_libcasm_TOOL.os2 = GCC3OMF
     120if defined(CFG_LIBC_USE_WATCOM) || defined(CFG_KNIX_USE_WATCOM)
     121 TEMPLATE_libcasm_TOOL = OPENWATCOM
     122else
     123 TEMPLATE_libcasm_TOOL = GCC3
     124 TEMPLATE_libcasm_TOOL.os2 = GCC3OMF
     125endif
    114126TEMPLATE_libcasm_INCS = $(PATH_LIBC_INC) $(dir $(LIBC-STD.H))
    115127TEMPLATE_libcasm_INST = usr/lib/
     
    147159# Only permit #include <include/emx/bigint.h>.
    148160TEMPLATE_bldprog = Build programs
    149 TEMPLATE_bldprog_TOOL = GCC3
    150161TEMPLATE_bldprog_DEFS = __LIBC_BUILD_PROGRAM__
    151 TEMPLATE_bldprog_INCS = $(PATH_LIBC_ROOT)
     162if defined(CFG_LIBC_USE_WATCOM) || defined(CFG_KNIX_USE_WATCOM)
     163 TEMPLATE_bldprog_TOOL = OPENWATCOM
     164 TEMPLATE_bldprog_INCS = $(TOOL_OPENWATCOM_CXXINCS) $(PATH_LIBC_ROOT)
     165 TEMPLATE_bldprog_BLD_TRG_ARCH = x86
     166 TEMPLATE_bldprog_CFLAGS = -za99
     167else
     168 TEMPLATE_bldprog_TOOL = GCC3
     169 TEMPLATE_bldprog_INCS = $(PATH_LIBC_ROOT)
     170endif
    152171
    153172
     
    205224$(1)_p_SOURCES.$(BUILD_TARGET_CPU) = $($(1)_SOURCES.$(BUILD_TARGET_CPU))
    206225endif # CFG_LIBC_PROFILED_LIBS
    207 endef
     226endef # def_libc_variants
    208227
    209228define def_libc_variants2
  • TabularUnified trunk/libc/include/386/builtin.h

    r2781 r3820  
    1616                                       signed char v)
    1717{
     18#ifdef __WATCOMC__
     19  /** @todo next up */
     20#else
    1821  __asm__ __volatile__ ("xchgb %0, %1" : "=m"(*p), "=r"(v) : "1"(v));
     22#endif
    1923  return v;
    2024}
  • TabularUnified trunk/libc/include/386/signal.h

    r1574 r3820  
    131131        int     sc_fpformat;
    132132        int     sc_ownedfp;
    133         int     sc_spare1[1];
     133        int     sc_spare1[1+1]; /* bird: added one int here to get the desire alignment.*/
     134#ifdef __GNUC__ /* bird */
    134135        int     sc_fpstate[128] __aligned(16);
     136#else
     137        int     sc_fpstate[128];
     138#endif
    135139        int     sc_spare2[8];
    136140};
     141
     142_Static_assert(!(__offsetof(struct sigcontext, sc_fpstate) & 15),); /* bird */
     143
    137144
    138145#define sc_sp           sc_esp
  • TabularUnified trunk/libc/include/sys/cdefs.h

    r3819 r3820  
    88 * @changed bird: __offsetof__ was apparently introduced in gcc 3.4.x.
    99 */
    10 
     10 
    1111/*-
    1212 * Copyright (c) 1991, 1993
     
    126126
    127127/*
     128 * Compiler checks for MSC and OpenWatcom. (bird)
     129 */
     130#ifdef __WATCOMC__
     131# define __KLIBC_WATCOM_PREREQ(ma, mi)  (__WATCOMC__ >= (ma)*10 + (mi))
     132#else
     133# define __KLIBC_WATCOM_PREREQ(ma, mi)  0
     134#endif
     135
     136#ifdef _MSC_VER
     137# define __KLIBC_MSVC_PREREQ(ma, mi)    (_MSC_VER >= (ma)*100 + (mi)*10)
     138#else
     139# define __KLIBC_MSVC_PREREQ(ma, mi)    0
     140#endif
     141/* bird - end: Compiler checks for MSC and OpenWatcom. */
     142
     143/*
    128144 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
    129145 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
     
    318334
    319335/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
    320 #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
     336#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) && !defined(__WATCOMC__) /* bird: Watcom */
    321337#define __func__        NULL
    322338#endif
  • TabularUnified trunk/libc/src/fbsdlibc/db/db/db.c

    r1694 r3820  
    5757
    5858#define DB_FLAGS        (DB_LOCK | DB_SHMEM | DB_TXN)
    59 #ifdef __EMX__ /* TODO: add the missing flags! */
     59#ifdef __IN_KLIBC__ /* TODO: add the missing flags! */
    6060#define USE_OPEN_FLAGS                                                  \
    6161        (O_CREAT | O_EXCL /*| O_EXLOCK*/ | O_NONBLOCK | O_RDONLY |              \
  • TabularUnified trunk/libc/src/fbsdlibc/db/recno/rec_close.c

    r976 r3820  
    4141#include <sys/types.h>
    4242#include <sys/uio.h>
    43 #ifndef __EMX__
     43#if !defined(__IN_KLIBC__) || !defined(__OS2__)
    4444#include <sys/mman.h>
    4545#endif
     
    8383        /* Committed to closing. */
    8484        status = RET_SUCCESS;
    85 #ifndef __EMX__
     85#if !defined(__IN_KLIBC__) || !defined(__OS2__)
    8686        if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
    8787                status = RET_ERROR;
  • TabularUnified trunk/libc/src/fbsdlibc/gdtoa/gdtoaimp.h

    r1871 r3820  
    178178#ifndef GDTOAIMP_H_INCLUDED
    179179#define GDTOAIMP_H_INCLUDED
    180 #ifdef __EMX__
     180#ifdef __IN_KLIBC__
    181181#include "namespace.h"
    182182#endif
     
    194194
    195195#include "namespace.h"
    196 #ifdef __EMX__
     196#ifdef __IN_KLIBC__
    197197#include <386/builtin.h>
    198198#include <sys/fmutex.h>
    199 #else /* !__EMX__ */
     199#else /* !__IN_KLIBC__ */
    200200#include <pthread.h>
    201 #endif /* !__EMX__ */
     201#endif /* !__IN_KLIBC__ */
    202202#include "un-namespace.h"
    203203
     
    478478
    479479#define MULTIPLE_THREADS
    480 #ifdef __EMX__
     480#ifdef __IN_KLIBC__
    481481extern _fmutex __libc_gdtoa_locks[2];
    482482#define ACQUIRE_DTOA_LOCK(n)    do {                            \
     
    488488    _fmutex_checked_release(&__libc_gdtoa_locks[n]);                 \
    489489} while(0)
    490 #else /* !__EMX__ */
     490#else /* !__IN_KLIBC__ */
    491491extern pthread_mutex_t __gdtoa_locks[2];
    492492#define ACQUIRE_DTOA_LOCK(n)    do {                            \
     
    498498                _pthread_mutex_unlock(&__gdtoa_locks[n]);       \
    499499} while(0)
    500 #endif /* !__EMX__ */
     500#endif /* !__IN_KLIBC__ */
    501501
    502502#define Kmax 15
     
    651651 extern int strtodg ANSI((CONST char*, char**, FPI*, Long*, ULong*));
    652652
    653 #ifdef __EMX__
     653#ifdef __IN_KLIBC__
    654654 extern char*   g_ddfmt  ANSI((char*, double*, int, unsigned));
    655655 extern char*   g_dfmt   ANSI((char*, double*, int, unsigned));
     
    658658 extern char*   g_xfmt   ANSI((char*, void*,   int, unsigned));
    659659 extern char*   g_xLfmt  ANSI((char*, void*,   int, unsigned));
    660 #endif /* __EMX__ */
     660#endif /* __IN_KLIBC__ */
    661661
    662662 extern int strtoId ANSI((CONST char *, char **, double *, double *));
  • TabularUnified trunk/libc/src/genalias/genalias.c

    r2717 r3820  
    11/* $Id: $ */
    22/** @file
    3  *
    43 * genalias - generate a number of alias objects.
    5  *
    6  * Copyright (c) 2006 knut st. osmundsen <bird@innotek.de>
     4 */
     5
     6/*
     7 * Copyright (c) 2006-2014 knut st. osmundsen <bird@innotek.de>
    78 *
    89 *
     
    3233#include <stdio.h>
    3334#include <stdint.h>
     35#include <string.h>
    3436#include <time.h>
    3537#include <assert.h>
     
    188190#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
    189191    assert(sizeof(Hdr) == 20); assert(sizeof(Sym) == 18); assert(sizeof(Aux) == sizeof(Sym));
    190 #pragma pack()
     192#pragma pack(0)
    191193    const size_t cchAlias = strlen(pszAlias);
    192194    const size_t cchReal = strlen(pszReal);
  • TabularUnified trunk/libc/src/libc/conv/makepow5.c

    r2682 r3820  
    33#include <stdio.h>
    44#include <stdlib.h>
    5 #include <getopt.h>
     5#include <string.h>
    66#include "include/emx/bigint.h"
    77
     
    2525
    2626
    27 static void usage (void)
     27static int usage (void)
    2828{
    2929  puts ("makepow5 -- Copyright (c) 1996 by Eberhard Mattes\n");
    3030  puts ("Usage:");
    3131  puts ("  makepow5 [-o <output_file>] [-s] [-m <threshold>] <max_exponent>");
    32   exit (1);
     32  return 1;
    3333}
    3434
     
    238238int main (int argc, char *argv[])
    239239{
    240   int c;
     240  int iArg;
    241241  char *end;
    242242
    243   while ((c = getopt (argc, argv, "m:o:s")) != -1)
    244     switch (c)
     243  for (iArg = 1; iArg < argc; iArg++)
     244    if (argv[iArg][0] != '-')
    245245      {
    246       case 'm':
    247         long_mul_threshold = strtol (optarg, &end, 10);
    248         if (long_mul_threshold < 1 || *end != 0)
    249           usage ();
    250         break;
    251 
    252       case 'o':
    253         out_fname = optarg;
    254         break;
    255 
    256       case 's':
    257         single_prec = 1;
    258         break;
    259 
    260       default:
    261         usage ();
     246        if (max_exponent)
     247          return usage ();
     248        max_exponent = strtol (argv[iArg], &end, 10);
     249        if (max_exponent < 1 || *end != 0)
     250          return usage ();
    262251      }
    263 
    264   if (argc - optind != 1)
    265     usage ();
    266 
    267   max_exponent = strtol (argv[optind], &end, 10);
    268   if (max_exponent < 1 || *end != 0)
    269     usage ();
     252    else
     253      {
     254        int    c = argv[iArg][1];
     255        char *optarg = NULL;
     256
     257        if (strchr (c, "ms"))
     258          {
     259            if (   argv[iArg][2] == ':'
     260                || argv[iArg][2] == '=')
     261              optarg = &argv[iArg][3];
     262            else if (iArg + 1 >= argc)
     263              return usage ();
     264            else
     265              optarg = argv[++iArg];
     266          }
     267
     268        switch (c)
     269            {
     270            case 'm':
     271              {
     272                long_mul_threshold = strtol (optarg, &end, 10);
     273                if (long_mul_threshold < 1 || *end != 0)
     274                  return usage ();
     275                break;
     276              }
     277
     278            case 'o':
     279              out_fname = optarg;
     280              break;
     281
     282            case 's':
     283              single_prec = 1;
     284              break;
     285
     286            default:
     287              return usage ();
     288            }
     289      }
    270290
    271291  compute_all_powers ();
Note: See TracChangeset for help on using the changeset viewer.