mescc: Produce M1 output instead of hex2.
[mes.git] / src / src.make
1 MODULES:=\
2  src/gc.c\
3  src/lib.c\
4  src/math.c\
5  src/mes.c\
6  src/posix.c\
7  src/reader.c\
8  src/vector.c
9 #
10
11 $(OUT)/%.h $(OUT)/%.i $(OUT)/%.environment.i $(OUT)/%.symbols.i: DIR:=$(DIR)
12 $(OUT)/%.h $(OUT)/%.i $(OUT)/%.environment.i $(OUT)/%.symbols.i: %.c build-aux/mes-snarf.scm
13         @echo " SNARF   $(notdir $<) -> $(notdir $@)"
14         @mkdir -p $(dir $@)
15         $(QUIET)OUT=$(dir $@) build-aux/mes-snarf.scm $<
16
17 SNARF.GCC:=$(MODULES:%.c=$(OUT)/%.h) $(MODULES:%.c=$(OUT)/%.i) $(MODULES:%.c=$(OUT)/%.environment.i)
18 SNARF.GCC+=$(OUT)/$(DIR)/mes.symbols.i
19 CLEAN+=$(SNARF.GCC)
20 snarf-gcc: $(SNARF.GCC)
21
22 $(OUT)/$(DIR)/mes.o: $(SNARF.GCC)
23
24 DEFINES:=FIXED_PRIMITIVES=1 MES_FULL=1 POSIX=1 VERSION='"$(VERSION)"' MODULEDIR='"$(MODULEDIR)"' PREFIX='"$(PREFIX)"'
25 INCLUDES:=mlibc $(OUT)/$(DIR)
26 TARGET:=mes
27 C_FILES:=$(DIR)/mes.c
28 include make/bin.make
29
30 $(OUT)/%.mes.h $(OUT)/%.mes.i $(OUT)/%.mes.environment.i $(OUT)/%.mes.symbols.i: DIR:=$(DIR)
31 $(OUT)/%.mes.h $(OUT)/%.mes.i $(OUT)/%.mes.environment.i $(OUT)/%.mes.symbols.i: %.c build-aux/mes-snarf.scm
32         @echo " SNARF   $(notdir $<) -> $(notdir $@)"
33         @mkdir -p $(dir $@)
34         $(QUIET)OUT=$(dir $@) build-aux/mes-snarf.scm --mes $<
35
36 SNARF.MES:=$(MODULES:%.c=$(OUT)/%.mes.h) $(MODULES:%.c=$(OUT)/%.mes.i) $(MODULES:%.c=$(OUT)/%.mes.environment.i)
37 SNARF.MES+=$(OUT)/$(DIR)/mes.mes.symbols.i
38 CLEAN+=$(SNARF.MES)
39 snarf-mes: $(SNARF.MES)
40
41 include make/reset.make
42
43 CROSS:=$(CC32:%gcc=%)
44 $(OUT)/$(CROSS)%: $(OUT)/%.mlibc
45         @ln -sf $(<F) $@
46
47 TARGET:=mes.mlibc
48 $(OUT)/$(DIR)/mes.$(CROSS)o: $(SNARF.MES)
49 C_FILES:=$(DIR)/mes.c
50 DEFINES:=FIXED_PRIMITIVES=1 MES_FULL=1 VERSION='"$(VERSION)"' MODULEDIR='"$(MODULEDIR)"' PREFIX='"$(PREFIX)"'
51 include make/bin-mlibc.make
52
53 TARGET:=mes.guile
54 $(OUT)/$(DIR)/mes.guile-E: $(SNARF.MES)
55 $(OUT)/mes.guile: $(SNARF.MES)
56 C_FILES:=$(DIR)/mes.c
57 include make/mescc-guile.make
58
59 ifneq ($(MES_BOOTSTRAP),)
60 safe-MES_MAX_ARENA:=$(MES_MAX_ARENA)
61 MES_MAX_ARENA:=80000000
62 TARGET:=mes.mes
63 $(OUT)/$(DIR)/mes.mes-E: $(SNARF.MES)
64 $(OUT)/mes.mes: $(SNARF.MES)
65 mes.mes: $(OUT)/mes.mes
66         cp $< $@
67 C_FILES:=$(DIR)/mes.c
68 include make/mescc-mes.make
69 MES_MAX_ARENA=$(safe-MES_MAX_ARENA)
70 endif