Permalink
Browse files

Don't try to include #ifdef-ed out primitives to the list.

  • Loading branch information...
1 parent f42537c commit d7eac0e3b376b2d470cdad8978919ce6524db6ae @whitequark whitequark committed with Sep 9, 2011
Showing with 15 additions and 2 deletions.
  1. +2 −1 vm/.gitignore
  2. +8 −1 vm/Makefile
  3. +5 −0 vm/include/primitives.h
View
@@ -2,4 +2,5 @@
include/arch
picobit-vm
picobit.hex
-picobit.elf
+picobit.elf
+.primitives.p
View
@@ -89,10 +89,17 @@ obj-y = $(addprefix $(arch)/,$(arch-y)) \
.PHONY: arch-all
arch-all:
-prim-gen = gawk -f scripts/scanner.awk -f scripts/prim-$(1).awk $(obj-y) >$(2)
+prim-intermediate := .primitives.p
+prim-gen = gawk -f scripts/scanner.awk -f scripts/prim-$(1).awk \
+ $(prim-intermediate) >$(2)
.PHONY: primitive-gen
primitive-gen: $(obj-y)
+ rm -f $(prim-intermediate)
+ for object in $(obj-y); do \
+ $(CROSS)cpp -DNO_PRIMITIVE_EXPAND $(CFLAGS) \
+ $$object -o - >>$(prim-intermediate); \
+ done
$(call prim-gen,headergen,include/gen.primitives.h)
$(call prim-gen,schemegen,../compiler/gen.primitives.rkt)
$(call prim-gen,dispatchgen,core/gen.dispatch.c)
@@ -5,11 +5,16 @@
extern const char* const primitive_names[];
#endif /* CONFIG_DEBUG_STRINGS */
+/* For the primitive scanning pass. */
+#ifndef NO_PRIMITIVE_EXPAND
+
#define PRIMITIVE(scheme_name, c_name, args) \
void prim_ ## c_name ()
#define PRIMITIVE_UNSPEC PRIMITIVE
+#endif /* NO_PRIMITIVE_EXPAND */
+
/* Temporary storage for primitives */
extern obj a1, a2, a3;

0 comments on commit d7eac0e

Please sign in to comment.