libk  Diff

Differences From Artifact [f0df06fe05]:

To Artifact [a535931ecd]:


            1  +## kcore/makefile
            2  +# kcore has to include, among other things, a replacement
            3  +# for stddef.h, and that can't be written in portable C,
            4  +# so we're generating it at build time.
            5  +#
            6  +# look, imma just be straight with you. the mechanism we're
            7  +# using to generate these headers is unbelievably heinous.
            8  +# it's inelegant, it's gross, and it's horrible. in the long
            9  +# term this NEEDS to be replaced with a bespoke solution
           10  +# instead of makefile gibberish. hopefully tho this will be
           11  +# enough in the short term for libk to get going, enough that
           12  +# someone more competent than me will someday be interested
           13  +# in fixing this horrorshow.
           14  +#
           15  +# until them: i'm sorry.
           16  +# very sincerely yours, lexi hale
           17  +
           18  +gen-headers = type.h
           19  +
     1     20   include ../modmake
           21  +
           22  +${OUT}/k/type.h: ${TMP}/type.${TARGET}.i
           23  +	cp $< $@
           24  +
           25  +# generating C source in makeā€¦ yaaay
           26  +define arch =
           27  +${TMP}/type.$(1).%.$(2).i: type.$(1).$(2).i def.%.i ${TMP}
           28  +	echo '#ifndef KItype' > $$@
           29  +	echo '#define KItype' >> $$@
           30  +	cat def.$$*.i >> $$@
           31  +	cat $$< >> $$@
           32  +	echo '#endif' >> $$@
           33  +endef
           34  +
           35  +$(eval $(call arch,x86,32))
           36  +$(eval $(call arch,x86,64))
           37  +