libk  Check-in [0c20d256a6]

Overview
Comment:port header macro files to m4; delete gpp infra; fix glaring syntax errors in kcore/type.h
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0c20d256a6feb4d2fc5394b0f4e215c6cbbeaf6ed6fe7c114aca01981db9839c
User & Date: lexi on 2019-07-27 05:28:14
Other Links: manifest | tags
Context
2019-08-18
10:20
fix kmheapa() and add kmheapf() check-in: 5279674525 user: lexi tags: trunk
2019-07-27
05:28
port header macro files to m4; delete gpp infra; fix glaring syntax errors in kcore/type.h check-in: 0c20d256a6 user: lexi tags: trunk
03:59
fix typo check-in: 85bec55157 user: lexi tags: trunk
Changes

Modified arch/typesize.c from [9ee84449d7] to [71add081ad].

    25     25   		found_sz = 1, sflag(type_sz, "unsigned " #type); \
    26     26   	if (!found_ofs && sizeof(type) == sizeof(ptrdiff_t)) \
    27     27   		found_ofs = 1, sflag(type_offset, "signed " #type); \
    28     28   }
    29     29   
    30     30   int main() {
    31     31   	int found_sz = 0, found_ofs = 0, found_type = 0;
    32         -	iflag(byte_bits,CHAR_BIT);
           32  +	iflag(arch_byte_bits,CHAR_BIT);
    33     33   	describe_integral(char,char);
    34     34   	describe_integral(short,short);
    35     35   	describe_integral(int,int);
    36     36   	describe_integral(long,long);
    37     37   	describe_integral(long long,llong);
    38     38   	printf("\n");
    39     39   	return 0;
    40     40   }

Deleted grammar/grammar.gpp version [89005aac7c].

     1         -#define flag -#1
     2         -#define		exec x
     3         -#define mode flag(#1)#2
     4         -#define		user U
     5         -#define		meta M
     6         -#define add +#1
     7         -#define del -#1
     8         -#define		unix_lf z
     9         -#define 	keepnl n
    10         -#define		tri #1#2#3
    11         -#define 	comment c
    12         -#define 	string s
    13         -#define		quote q
    14         -#define		eval S
    15         -#define		evalquote Q
    16         -#define stack bal_stack bal_unstack
    17         -#define meta_grammar meta_start meta_end meta_arg_start meta_sep meta_arg_end stack
    18         -#define user_grammar call_start call_end arg_start arg_sep arg_end stack arg_num_char quote_char

Deleted grammar/makefile version [8c2d1af7ce].

     1         -${TMP}/%: %.gpp grammar.gpp
     2         -	${gpp} $< | tr "\n" ' ' > $@

Deleted grammar/precomp.g.gpp version [d33952f39e].

     1         -#include grammar.gpp
     2         -#mode comment "//" "\n"
     3         -// this file defines the "precomp" grammar, the grammar
     4         -// that's used to process C code templates
     5         -// vim: ft=c
     6         -#define call_start     "["
     7         -#define call_end       "]"
     8         -#define arg_start      " "
     9         -#define arg_sep        ",\\w"
    10         -#define arg_end        "]"
    11         -#define bal_stack      "\(["
    12         -#define bal_unstack    "\)]"
    13         -#define arg_num_char   "\\$"
    14         -#define quote_char     "|"
    15         -#define meta_start     "\\w["
    16         -#define meta_end       "]\\w"
    17         -#define meta_arg_start " "
    18         -#define meta_sep       "\\w:\\w"
    19         -#define meta_arg_end   "]\\W"
    20         -add(unix_lf)
    21         -add(comment "---" "\\n")
    22         -add(comment "(*" "*)")
    23         -flag(exec)
    24         -mode(user, user_grammar)
    25         -mode(meta, meta_grammar)

Modified kcore/def.h.m from [9c53671363] to [694c1d32cc].

     1         ---- kcore/def.h.m → <k/def.h>
     2         ---- ~ lexi hale <lexi@hale.su>
     3         ---- this file gathers information on the environment it's
     4         ---- being compiled in, setting macros that other headers
     5         ---- need. it will be emitted as <k/def.h>.
     6         ---- vim: ft=c
            1  +dnl kcore/def.h.m → <k/def.h>
            2  +dnl ~ lexi hale <lexi@hale.su>
            3  +dnl this file gathers information on the environment it's
            4  +dnl being compiled in, setting macros that other headers
            5  +dnl need. it will be emitted as <k/def.h>.
            6  +dnl vim: ft=c
     7      7   #ifndef KIdef
     8      8   #define KIdef
            9  +define(`def',`#define $1 $2')
           10  +
           11  +ifdef(`atom_target_bits',`
           12  +	define(`target',`atom_target_arch.atom_target_os.atom_target_bits')
           13  +	def(KVbits,atom_target_bits)',`
           14  +	define(`target',atom_target_arch.atom_target_os)')
           15  +
           16  +def(KVtarget,target)
           17  +def(KVos,atom_target_os)
           18  +def(KVarch,atom_target_arch)
     9     19   
    10         -[ifdef atom_target_bits]
    11         -	[define target: [atom_target_arch].[atom_target_os].[atom_target_bits]]
    12         -	#define KVbits [atom_target_bits]
    13         -[else]
    14         -	[define target: [atom_target_arch].[atom_target_os]]
    15         -[endif]
    16         -#define KVtarget [target]
    17         -#define KVos [atom_target_os]
    18         -#define KVarch [atom_target_arch]
    19         -[if [target_unix] == yes]
    20         -	#define KFenv_unix
    21         -	#define KFenv_posix
    22         -[else]
    23         -	[if [target_posix] == yes]
    24         -		#define KFenv_posix
    25         -	[endif]
    26         -[endif]
           20  +ifelse(target_unix,`yes',
           21  +		`def(`KFenv_unix',)
           22  +		def(`KFenv_posix',)',`
           23  +		ifelse(target_posix,`yes',
           24  +			`def(KFenv_posix)')')
    27     25   
    28     26   #define Kpragma(p) _Pragma(#p)
    29     27   #if defined(__GNUC__) || defined(__clang__)
    30     28   #   define Kerror(msg) Kpragma(GCC error #msg) 
    31     29   #else
    32     30   #   define Kerror(msg) Kpragma(message #msg)
    33     31   #endif
    34     32   #define Knoimpl(fn) Kerror(no implementation of fn for platform [target])
    35     33   
    36     34   #endif

Modified kcore/makefile from [f9fefae3d1] to [e2db22ecce].

     4      4   # so we're generating it at build time.
     5      5   
     6      6   # gen-headers = type.h
     7      7   
     8      8   include ../modmake
     9      9   
    10     10   ${OUT}/k/type.h: type.h.m ${TMP}/typesize.def
    11         -	$(m-comp) $< $(file < ${TMP}/typesize.def) > $@
           11  +	$(m-comp) $(file < ${TMP}/typesize.def) $< > $@
    12     12   
    13     13   ## the below code predates the introduction of gpp
    14     14   ## to generate these headers from templates instead
    15     15   ## of trying to write one for everypossible arch 
    16     16   ## tuple. it is left as a monument to a terrible
    17     17   ## and now blissfully forgotten past.
    18     18   #

Modified kcore/type.h.m from [def2d33e25] to [6926347ff4].

     1         ---- kcore/type.h.m → <k/type.h>
     2         ---- ~ lexi hale <lexi@hale.su>
     3         ---- this file gathers information on the environment it's
     4         ---- being compiled in, defining types that our code
     5         ---- needs. it will be emitted as <k/type.h>.
     6         ---- vim: ft=c
            1  +dnl kcore/type.h.m → <k/type.h>
            2  +dnl ~ lexi hale <lexi@hale.su>
            3  +dnl this file gathers information on the environment it's
            4  +dnl being compiled in, defining types that our code
            5  +dnl needs. it will be emitted as <k/type.h>.
            6  +dnl vim: ft=c
            7  +changequote(`“',`”')
     7      8   #ifndef KItype
     8      9   #define KItype
     9     10   
    10     11   /* we define 64-bit types first due to an oddity in how
    11     12    * 128-bit types are handled: we want kc_?big to reference
    12     13    * the absolute largest type available to the compiler,
    13     14    * but in some cases, 128-bits may not be among the
................................................................................
    18     19    * that supports the 128-bit extension - but only if a
    19     20    * native 128-bit type is not available.
    20     21    * 
    21     22    * once this is done, we can be certain that u128 will
    22     23    * reference the largest available integer type and can
    23     24    * safely define kc_?big by reference to it. */
    24     25   
    25         -[ifdef type_bit64]
    26         -	typedef unsigned [type_bit64] u64;
    27         -	typedef   signed [type_bit64] s64;
    28         -	[ifndef type_bit128]
           26  +
           27  +ifdef(“type_bit64”,“
           28  +	typedef unsigned type_bit64 u64;
           29  +	typedef   signed type_bit64 s64;
           30  +	ifdef(“type_bit128”,,“
    29     31   	/* even if no native type is 128 bits long, clang and
    30     32   	 * gcc have extensions to support 128 bit arithmetic
    31     33   	 * on 64-bit hardware */
    32     34   #		if defined(__GNUC__) || defined(__clang__)
    33         -			typedef unsigned __int128_t u128;
    34         -			typedef   signed __int128_t s128;
           35  +			typedef __uint128_t u128;
           36  +			typedef  __int128_t s128;
    35     37   #		else
    36         -			/* if we don't have access to that extension
           38  +			/* if we don`'t have access to that extension
    37     39   			 * or native 128-bit types, then we just use
    38     40   			 * the largest native type specified in the
    39     41   			 * C standard */
    40     42   			typedef unsigned long long u128;
    41     43   			typedef   signed long long s128;
    42     44   #		endif
    43         -	[endif]
    44         -[else]
           45  +	”)”,“dnl
    45     46   	typedef unsigned long long u64;
    46     47   	typedef   signed long long s64;
    47     48   
    48     49   	typedef u64 u128;
    49     50   	typedef	s64 s128;
    50         -[endif]
           51  +”)dnl
    51     52   
    52         -[ifdef type_bit128]
    53         -	typedef unsigned [type_bit128] u128;
    54         -	typedef   signed [type_bit128] s128;
    55         -[endif]
           53  +ifdef(“type_bit128”,“dnl
           54  +	typedef unsigned type_bit128 u128;
           55  +	typedef   signed type_bit128 s128;
           56  +”)dnl
    56     57   
    57     58   typedef unsigned char ubyte;
    58     59   typedef   signed char sbyte;
    59     60   typedef          u128 ubig;
    60     61   typedef          s128 sbig;
    61     62   
    62         -[ifdef type_bit8]
    63         -	typedef unsigned [type_bit8] u8;
    64         -	typedef   signed [type_bit8] s8;
    65         -[else]
           63  +ifdef(“type_bit8”,“dnl
           64  +	typedef unsigned type_bit8 u8;
           65  +	typedef   signed type_bit8 s8;
           66  +”,“dnl
    66     67   	typedef ubyte u8;
    67     68   	typedef	sbyte s8;
    68         -[endif]
           69  +”)dnl
    69     70   
    70         -[ifdef type_bit16]
    71         -	typedef unsigned [type_bit16] u16;
    72         -	typedef   signed [type_bit16] s16;
    73         -[else]
           71  +ifdef(“type_bit16”,“
           72  +	typedef unsigned type_bit16 u16;
           73  +	typedef   signed type_bit16 s16;
           74  +”,“
    74     75   	typedef ubig u16;
    75     76   	typedef	sbig s16;
    76         -[endif]
           77  +”)dnl
    77     78   
    78         -[ifdef type_bit32]
    79         -	typedef unsigned [type_bit32] u32;
    80         -	typedef   signed [type_bit32] s32;
    81         -[else]
           79  +ifdef(“type_bit32”,“
           80  +	typedef unsigned type_bit32 u32;
           81  +	typedef   signed type_bit32 s32;
           82  +”,“
    82     83   	typedef ubig u32;
    83     84   	typedef	sbig s32;
    84         -[endif]
           85  +”)dnl
    85     86   
    86     87   enum /* max-min values of each type */ {
    87         -	byte_bits = [byte_bits],
           88  +	byte_bits = arch_byte_bits,
    88     89   
    89     90   	  u8_min = 0,   u8_max = ((u8)-1),
    90     91   	 u16_min = 0,  u16_max = ((u16)-1),
    91     92   	 u32_min = 0,  u32_max = ((u32)-1),
    92         -	 u64_min = 0,  u32_max = ((u64)-1),
           93  +	 u64_min = 0,  u64_max = ((u64)-1),
    93     94   	u128_min = 0, u128_max = ((u128)-1),
    94     95   
    95     96   	/* assuming two's complement. TODO: check math */
    96         -	[define merge: $1$2]
    97         -	[define [sspec type]:
    98         -		[merge [type],_min] = 0 - ((1 << sizeof([type]) * kc_byte_bits) / 2),
    99         -		[merge [type],_max] =      (1 << sizeof([type]) * kc_byte_bits) / 2 - 1]
           97  +	define(“sspec”,“
           98  +		$1_min = 0 - ((1 << sizeof($1) * byte_bits) / 2),
           99  +		$1_max =      (1 << sizeof($1) * byte_bits) / 2 - 1”)dnl
   100    100   
   101         -	[sspec s8], [sspec s16], [sspec s32],
   102         -	[sspec s64], [sspec s128],
          101  +	sspec(s8), sspec(s16), sspec(s32),
          102  +	sspec(s64), sspec(s128),
   103    103   
   104         -	kc_uchar_min  = 0, kc_uchar_max  = [type_max_u_char],
   105         -	kc_ushort_min = 0, kc_ushort_max = [type_max_u_short],
   106         -	kc_uint_min   = 0, kc_uint_max   = [type_max_u_int],
   107         -	kc_ulong_min  = 0, kc_ulong_max  = [type_max_u_long],
   108         -	kc_ullong_min = 0, kc_ullong_max = [type_max_u_llong],
          104  +	kc_uchar_min  = 0, kc_uchar_max  = type_max_u_char,
          105  +	kc_ushort_min = 0, kc_ushort_max = type_max_u_short,
          106  +	kc_uint_min   = 0, kc_uint_max   = type_max_u_int,
          107  +	kc_ulong_min  = 0, kc_ulong_max  = type_max_u_long,
          108  +	kc_ullong_min = 0, kc_ullong_max = type_max_u_llong,
   109    109   
   110         -	kc_schar_min  = [type_min_s_char],  kc_schar_max  = [type_max_s_char],
   111         -	kc_sshort_min = [type_min_s_short], kc_sshort_max = [type_max_s_short],
   112         -	kc_sint_min   = [type_min_s_int],   kc_sint_max   = [type_max_s_int],
   113         -	kc_slong_min  = [type_min_s_long],  kc_slong_max  = [type_max_s_long],
   114         -	kc_sllong_min = [type_min_s_llong], kc_sllong_max = [type_max_s_llong],
          110  +	kc_schar_min  = type_min_s_char,  kc_schar_max  = type_max_s_char,
          111  +	kc_sshort_min = type_min_s_short, kc_sshort_max = type_max_s_short,
          112  +	kc_sint_min   = type_min_s_int,   kc_sint_max   = type_max_s_int,
          113  +	kc_slong_min  = type_min_s_long,  kc_slong_max  = type_max_s_long,
          114  +	kc_sllong_min = type_min_s_llong, kc_sllong_max = type_max_s_llong,
   115    115   
   116    116   	ubig_min = u128_min, ubig_max = u128_max,
   117    117   	sbig_min = s128_min, sbig_max = s128_max,
   118    118   
   119    119   	ubyte_min = kc_uchar_min, ubyte_max = kc_uchar_max,
   120    120   	sbyte_min = kc_schar_min, sbyte_max = kc_schar_max,
   121    121   };
   122    122   
   123         -[ifdef type_sz]
   124         -	typedef [type_sz] sz;
   125         -[else]
          123  +ifdef(“type_sz”,“
          124  +	typedef type_sz sz;
          125  +”,“dnl
   126    126   #	ifdef __cplusplus
   127    127    	   /* C++ gives us a clean, standardized way to do this */
   128    128    	   typedef decltype (sizeof(char)) sz;
   129    129   #	else
   130    130   #		if defined(__GNUC__) || defined(__clang__)
   131    131   			typedef __typeof__ (sizeof(char)) sz;
   132    132   #		else
................................................................................
   133    133   			/* we're stumped - set sz to the safest possible value under
   134    134   			 * the circumstances, and warn the user. */
   135    135   #			warning no authoritative sz (size_t) type definition \
   136    136   			        available; defaulting to largest unsigned integer type
   137    137   			typedef ubig sz;
   138    138   #		endif
   139    139   #	endif
   140         -[endif]
          140  +”)dnl
   141    141   
   142         -[ifdef type_offset]
   143         -	typedef [type_offset] offset;
   144         -[else]
          142  +ifdef(“type_offset”,“
          143  +	typedef type_offset offset;
          144  +”,“dnl
   145    145   #	ifdef __cplusplus
   146    146    	   /* C++ gives us a clean, standardized way to do this */
   147    147   		typedef decltype (((void*)-1) - 1) offset;
   148    148   #	else
   149    149   #		if defined(__GNUC__) || defined(__clang__)
   150    150   			typedef __typeof__ (((void*)10) - ((void*)5)) offset;
   151    151   #		else
................................................................................
   152    152   			/* no dice - set offset to the safest possible value under
   153    153   			 * the circumstances, and warn the user. */
   154    154   #			warning no authoritative offset (ptrdiff_t) type definition \
   155    155   			        available; defaulting to largest unsigned integer type
   156    156   			typedef sbig offset;
   157    157   #		endif
   158    158   #	endif
   159         -[endif]
          159  +”)dnl
   160    160   
   161    161   // exit status integer types - pls use kbad in <k/magic.h> instead
   162         -[if [target_posix] == yes]
          162  +ifelse(target_posix,“yes”,“
   163    163   	/* by convention, posix return values are 8-bit,
   164    164   	 * but note that many modern UNIXes do technically
   165    165   	 * support higher-bit values. for this reason,
   166    166   	 * longstat is defined differently under posix. */
   167    167   	typedef u8 stat;
   168    168   	typedef u32 stat_long;
   169         -[else]
   170         -	[if ([atom_target_os] == win) ||
   171         -		([atom_target_os] == vms)]
          169  +”,“dnl
          170  +	ifelse(atom_target_os,“win”,“
          171  +		typedef u32 stat;
          172  +	”,“dnl
          173  +	ifelse(atom_target_os,“vms”,“
   172    174   		typedef u32 stat;
   173         -	[else]
          175  +	”,“dnl
   174    176   		typedef u8 stat;
   175    177   		/* we don't know a specific exit status type
   176    178   		 * for your arch so we're going with a sane
   177    179   		 * default. if this is wrong, help us fix it! */
   178         -	[endif]
          180  +	”)”)dnl
   179    181   	typedef stat stat_long;
   180         -[endif]
          182  +”)dnl
   181    183   
   182    184   #endif

Modified libk.md from [3181eecb08] to [7bf377a763].

    31     31    9. **compatibility.** code that links against libk should be able to compile and run on any operating system. in the ideal case (Linux or FreeBSD) it will be able to do so without touching any other system libraries; for less ideal environments like Windows, libk will when necessary abstract over system libraries or libc itself.
    32     32    10. **sane error-handling.** every time you type `errno` god murders a puppy.
    33     33   
    34     34   ## dependencies
    35     35   
    36     36   libk is designed to be as portable and depedency-free as possible. ideally, it will be possible to compile code against libk using nothing but libk itself.
    37     37   
    38         -compiling libk is also designed to be as easy as possible. it has only two external dependencies, the macro processor [gpp], needed for compile-time header generation , and the [GNU make] utility, whose advanced features are needed to perform the relatively complex task of building all of libk from the ground up. 
           38  +compiling libk is also designed to be as easy as possible. it has only two external dependencies, the macro processor [m4], needed for compile-time header generation, and the [GNU make] utility, whose advanced features are needed to perform the relatively complex task of building all of libk from the ground up. 
    39     39   
    40         - [gpp]: http://en.nothingisreal.com/wiki/GPP
           40  + [m4]: http://www.gnu.org/software/m4
    41     41    [GNU make]: http://www.gnu.org/software/make
    42     42   
    43         -while gpp is a very small program that builds quickly and has no major dependencies of its own, it is an obscure program not likely to be found in any repositories and with an uncertain future. for these reasons, adding m4 translations of the gpp headers should be a long-term priority. being able to be built with both a very small, easily built macro processor, and a very large but extremely well-supported processor, should make libk maximally buildable and future-proof.
    44         -
    45         -while this project will include gpp tooling and GNU makefiles designed to ease the task of writing and building libk code (as well as tools in many other languages, including native binaries that compile against libk), none of them are required for the task.
           43  +a different macro processor, gpp, was used in early versions of libk, however, it was so obscure and took so much overly fragile infrastructure to make it work that the cleaner syntax just wasn't worth it; i've since deleted the gpp infra and ported the macro files to m4.
    46     44   
    47     45   ## naming conventions
    48     46   
    49     47   one of the most frustrating things about libc is its complete and total *lack* of a naming convention. in C, every function and global is injected into a single global namespace, including macros. this means that every libc header you include scatters words all over that namespace, potentially clobbering your function with a macro!
    50     48   
    51     49   libk is designed to fix this (in hindsight) glaring error.
    52     50   

Modified makefile from [ce9c7792cb] to [7c13625dc8].

     8      8   
     9      9   ifneq ($(BITS),)
    10     10       export TARGET = $(ARCH).$(OS).$(BITS)
    11     11   else
    12     12       export TARGET = $(ARCH).$(OS)
    13     13   endif
    14     14   
    15         -export gpp = gpp
           15  +export m4 = m4
    16     16   export lin-headers = /usr/include/asm
    17     17   export fbsd-headers = /usr/include/sys
    18     18   
    19     19   moddirs = $(wildcard k*)
    20     20   binaries = $(wildcard k*/*.exe.c)
    21     21   functions = $(wildcard k*/*.fn.c) 
    22     22   assemblies = $(wildcard k*/*.fn.$(TARGET).s)
................................................................................
    91     91   uninstall: $(header-dir)/k $(lib-dir)/k
    92     92   	rm -rf $^
    93     93   
    94     94   lists = moddirs functions assemblies fnobjects rtobjects binaries binmods POSIX
    95     95   dbg:
    96     96   	@echo -e lists: $(foreach var, $(lists), "\\n - \\e[1m$(var)\\e[m = $($(var))")
    97     97   
    98         -%.obj: %/makefile $(TMP)/precomp.g $(TARGET).calls $(OUT)
           98  +%.obj: %/makefile $(TARGET).calls $(OUT)
    99     99   	cd $* && $(MAKE) obj
   100    100   
   101         -%.tool: %/makefile $(TMP)/precomp.g $(OUT)
          101  +%.tool: %/makefile $(OUT)
   102    102   	cd $* && $(MAKE) tool
   103    103   
   104    104   %.dbg: %/makefile $(OUT)
   105    105   	cd $* && $(MAKE) dbg
   106    106   
   107         -%.def: %/makefile $(TMP)/precomp.g $(TMP)/typesize.def $(OUT) $(OUT)/k
          107  +%.def: %/makefile $(TMP)/typesize.def $(OUT) $(OUT)/k
   108    108   	cd $* && $(MAKE) def
   109    109   
   110    110   %.calls: arch/makefile
   111    111   	cd arch && $(MAKE) $(TMP)/calls.$*.s
   112    112   
   113         -$(TMP)/precomp.g: grammar/precomp.g.gpp $(TMP)
   114         -	cd grammar && $(MAKE) $@
   115         -
   116    113   $(TMP)/typesize.def: arch/makefile $(TMP)
   117    114   	cd arch && $(MAKE) $@
   118    115   
   119    116   $(OUT)/libk.so: $(fnobjects) 
   120    117   	ld -shared $(COMPLIB) -o $@ $^
   121    118   	@# $(CC) -shared -fPIC -nostdlib $(COMPLIB) -o $@ $(OUT)/*.o
   122    119   

Modified modmake from [eb2aedd9b1] to [4d2e5850b0].

     9      9   headers = $(wildcard *.h) $(gen-headers) $(patsubst %.m,%,$(wildcard *.h.m))
    10     10   
    11     11   tools    = $(filter     %.exe.c,   $(src))
    12     12   nontools = $(filter-out %.exe.c,   $(src))
    13     13   cobjects = $(filter     %.c,       $(nontools))
    14     14   sobjects = $(filter %.${TARGET}.s, $(nontools))
    15     15   
    16         -gpp = gpp
    17     16   cflags = -std=c11 -isystem ${OUT} -fPIC -nostdlib ${COMPLIB} -L${OUT}
    18     17   
    19     18   m-env = atom_target_arch=${ARCH}
    20     19   m-env += atom_target_os=${OS}
    21     20   ifneq (${BITS},) #!!! ifdef does NOT work with environment variables
    22     21       m-env += atom_target_bits=${BITS}
    23     22   endif
    24     23   m-env += target_posix=${POSIX}
    25     24   m-env += target_unix=${UNIX}
    26     25   
    27         -m-grammar = $(file < ${TMP}/precomp.g)
    28         -m-comp = $(gpp) $(m-grammar) $(m-env:%=-D%)
           26  +m-comp = ${m4} $(m-env:%=-D%)
    29     27   
    30     28   obj: $(cobjects:%.c=${OUT}/$(mod).%.o) \
    31     29   	 $(sobjects:%.s=${OUT}/$(mod).%.o)
    32     30   tool: $(tools:%.exe.c=${OUT}/$(mod).%) \
    33     31   	  ${OUT}/libk.a
    34     32   
    35     33   def: $(headers:%=${OUT}/k/%)
................................................................................
    38     36   	@echo src = $(src)
    39     37   	@echo tools = $(tools)
    40     38   	@echo TARGET = ${TARGET}
    41     39   	@echo cobjects = $(cobjects)
    42     40   	@echo sobjects = $(sobjects)
    43     41   	@echo headers = $(headers)
    44     42   	@echo m-comp = $(m-comp)
    45         -	@echo m-grammar = $(m-grammar)
    46     43   	@echo m-env = $(m-env) "$(m-env:%=-D%)"
    47     44   	@echo mod = $(mod)
    48     45   
    49     46   ${OUT}/k/%.h: %.h.m
    50     47   	$(m-comp) $< > $@
    51     48   
    52     49   .PRECIOUS: ${TMP}/$(mod).%