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