Index: arch/typesize.c ================================================================== --- arch/typesize.c +++ arch/typesize.c @@ -1,13 +1,20 @@ #include #include #include -#define sflag(flag,val) printf("-D"#flag"=\"%s\" ", val) -#define mflag(flag,val) printf("-D"#flag"=-%llu ", val + 1) -#define iflag(flag,val) printf("-D"#flag"=%llu ", val) -#define fflag(flag,val) printf("-D"#flag"=%Lf ", val) +#ifndef _emit_m4_include +# define sflag(flag,val) printf("-D"#flag"=\"%s\" ", val) +# define mflag(flag,val) printf("-D"#flag"=-%llu ", val + 1) +# define iflag(flag,val) printf("-D"#flag"=%llu ", val) +# define fflag(flag,val) printf("-D"#flag"=%Lf ", val) +#else +# define sflag(flag,val) printf("define(`"#flag"',`%s')dnl\n", val) +# define mflag(flag,val) printf("define(`"#flag"',`%llu')dnl\n", val + 1) +# define iflag(flag,val) printf("define(`"#flag"',`%llu')dnl\n", val) +# define fflag(flag,val) printf("define(`"#flag"',`%Lf')dnl\n", val) +#endif #define type_found(val) (found_type & (val / 8)) #define checkbits(type,x) \ if(!type_found(x) && sizeof(type) == (x/CHAR_BIT)) \ sflag(type_bit##x, #type), found_type |= (x / 8) ADDED makerule Index: makerule ================================================================== --- makerule +++ makerule @@ -0,0 +1,29 @@ +#- makerule +# this file contains definitions shared between modmake and +# the top-leve makefile +# vim: ft=make + +ARCH ?= ${ARCH} +BITS ?= ${BITS} +OS ?= ${OS} + +POSIX ?= ${POSIX} +UNIX ?= ${UNIX} + +ROOT ?= ${ROOT} +TMP ?= ${TMP} +OUT ?= ${OUT} + +m4 ?= ${m4} + +cflags = -std=c11 -isystem $(OUT) -isystem $(TMP) -isystem $(ROOT)/arch -fPIC -nostdlib $(COMPLIB) -L$(OUT) + +m-env = atom_target_arch=$(ARCH) +m-env += atom_target_os=$(OS) +ifneq ($(BITS),) #!!! ifdef does NOT work with environment variables + m-env += atom_target_bits=$(BITS) +endif +m-env += target_posix=$(POSIX) +m-env += target_unix=$(UNIX) + +m-comp = $(m4) $(m-env:%=-D%)