mescc: Support regular C99 compile, headers + mlibc.
[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:=libc $(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 # TARGET:=$(CROSS)mes
44 CROSS:=$(CC32:%gcc=%)
45 $(OUT)/$(CROSS)%: $(OUT)/%.mlibc
46         @ln -sf $(<F) $@
47
48 TARGET:=mes.mlibc
49 $(OUT)/$(DIR)/mes.$(CROSS)o: $(SNARF.MES)
50 C_FILES:=$(DIR)/mes.c
51 DEFINES:=FIXED_PRIMITIVES=1 MES_FULL=1 VERSION='"$(VERSION)"' MODULEDIR='"$(MODULEDIR)"' PREFIX='"$(PREFIX)"'
52 include make/bin-mlibc.make
53
54 TARGET:=mes.guile
55 $(OUT)/mes.mes: module/mes/read-0-32.mo
56 $(OUT)/mes.guile: $(SNARF.MES)
57 C_FILES:=$(DIR)/mes.c
58 include make/mescc-guile.make
59
60 MAINTAINER-CLEAN+=mes.mes
61 ifeq ($(wildcard mes.mes),)
62 safe-MES_MAX_ARENA=$(MES_MAX_ARENA)
63 MES_MAX_ARENA:=80000000
64 TARGET:=mes.mes
65 $(OUT)/mes.mes: module/mes/read-0-32.mo
66 $(OUT)/mes.mes: $(SNARF.MES)
67 mes.mes: $(OUT)/mes.mes
68         cp $< $@
69 C_FILES:=$(DIR)/mes.c
70 include make/mescc-mes.make
71 MES_MAX_ARENA=$(safe-MES_MAX_ARENA)
72 endif