mes/make/mescc-mes.make
Jan Nieuwenhuizen 9f56b8b102 core: Always include reader.c, drop binary read-0-32.mo dependency.
* module/language/c99/compiler.mes (c99-input->full-ast): Remove
  obsolete __NYACC__ and MES_FULL defines.
* src/mes.c [!MES_FULL]: Include reader-mes.h.
  (mes_builtins) [!MES_FULL]: Include reader.mes.i, reader.me.environment.i.
  [!MES_FULL]: Include reader.c.
  (main) [!MES_FULL]: By default call load_env, only call bload_env
  when --load is supplied.  WAS: Always bload read-0-32.mo.
* src/reader.c (__end_of__mes_): Remove.
  (dump): Remove option of dumping tiny test program.
* make/mescc-mes.make ($(OUT)/$(TARGET), mescc.mes-ccompile,
  mescc.mes.c-compile-E): Depend on $(OUT)/mes, scripts/mes.
* src/src.make (mes.guile): Remove module/mes/read-32-0 dependency.
  Do not build $(OUT)/mes.mes.
* module/module.make (module/mes/read-0.mo, module/mes/read-0-32.mo,
  module/mes/tiny-0-32.mo): Remove targets.
  (CLEAN): Do not add them.  Neither install $(OUT)/mes.mes.
* .gitignore: Remove exceptions for them.
* make/install.make (install): Do not install them.
* HACKING: Update info about creating module/mes/read-32-0.mo.
* scaffold/mini-mes.c: Remove.
* scaffold/tiny-mes.c: Remove.
* scaffold/cons-mes.c: Remove.
* scaffold/scaffold.make (tiny-mes.libc, tiny-mes.guile, tiny-mes.mes,
  mini-mes.libc, mini-mes.guile, mini-mes.mes): Reemove targets.
2017-05-28 16:03:45 +02:00

97 lines
3.3 KiB
Makefile

CROSS:=mes-
C_FILES:=libc/libc-mes.c $(C_FILES)
O_FILES:=$(C_FILES:%.c=$(OUT)/%.$(CROSS)o)
ifneq ($(DEBUG),)
$(info TARGET=$(TARGET))
$(info C_FILES=$(C_FILES))
$(info O_FILES=$(O_FILES))
endif
CLEAN+=$(O_FILES) $(OUT)/$(TARGET)
CLEAN+=$(OUT)/$(TARGET)
INCLUDES+=libc/include libc $(OUT)/$(DIR)
MESCC.mes:=scripts/mescc.mes
MESLD.mes:=scripts/mescc.mes
$(OUT)/$(TARGET): ld:=MESLD.mes
$(OUT)/$(TARGET): LD:=$(MESLD.mes)
$(OUT)/$(TARGET): CC:=$(MESCC.mes)
$(OUT)/$(TARGET): CFLAGS:=
$(OUT)/$(TARGET): LDFLAGS:=
$(OUT)/$(TARGET): $(MAKEFILE_LIST)
$(OUT)/$(TARGET): scripts/mes
$(OUT)/$(TARGET): O_FILES:=$(O_FILES)
$(OUT)/$(TARGET): $(O_FILES)
@echo " $(ld) $(notdir $(O_FILES)) -> $(notdir $@)"
$(QUIET)$(LINK.c) $(O_FILES) $(LOADLIBES) $(LDLIBS) -o $@
define mescc.mes-c-compile
$(OUT)/$(1:.c=.$(CROSS)o): CROSS:=$(CROSS)
$(OUT)/$(1:.c=.$(CROSS)o): cc:=MESCC.mes
$(OUT)/$(1:.c=.$(CROSS)o): CC:=$(MESCC.mes)
$(OUT)/$(1:.c=.$(CROSS)o): COMPILE.c:=$(MESCC.mes) -c
$(OUT)/$(1:.c=.$(CROSS)o): CPPFLAGS:=$(2:%=-D %) $(3:%=-I %)
$(OUT)/$(1:.c=.$(CROSS)o): COMPILE.c:=$(MESCC.mes) -c $(CPPFLAGS)
$(OUT)/$(1:.c=.$(CROSS)o): OUT:=$(OUT)
$(OUT)/$(1:.c=.$(CROSS)o): $(MAKEFILE_LIST)
$(OUT)/$(1:.c=.$(CROSS)o): $(OUT)/mes
$(OUT)/$(1:.c=.$(CROSS)o): scripts/mes
$(OUT)/$(1:.c=.$(CROSS)o): $(INSTALL_MES_FILES)
$(OUT)/$(1:.c=.$(CROSS)o): $(1)
@echo " $$(cc) $$(notdir $(1)) -> $$(notdir $$@)"
@mkdir -p $$(dir $$@)
$$(QUIET)$$(COMPILE.c) $$(OUTPUT_OPTION) $(1)
endef
define mescc.mes-c-preprocess
$(OUT)/$(1:.c=.$(CROSS)E): CROSS:=$(CROSS)
$(OUT)/$(1:.c=.$(CROSS)E): cc:=MESCC.mes
$(OUT)/$(1:.c=.$(CROSS)E): CC:=$(MESCC.mes)
$(OUT)/$(1:.c=.$(CROSS)E): CPPFLAGS:=$(2:%=-D %) $(3:%=-I %)
$(OUT)/$(1:.c=.$(CROSS)E): OUT:=$(OUT)
$(OUT)/$(1:.c=.$(CROSS)E): PREPROCESS.c:=$(MESCC.mes) -E $(CPPFLAGS)
$(OUT)/$(1:.c=.$(CROSS)E): $(MAKEFILE_LIST)
$(OUT)/$(1:.c=.$(CROSS)E): $(OUT)/mes
$(OUT)/$(1:.c=.$(CROSS)E): scripts/mes
$(OUT)/$(1:.c=.$(CROSS)E): $(INSTALL_MES_FILES)
$(OUT)/$(1:.c=.$(CROSS)E): $(1)
@echo " $$(cc) $$(notdir $(1)) -> $$(notdir $$@)"
@mkdir -p $$(dir $$@)
$$(QUIET)$$(PREPROCESS.c) $$(CPPFLAGS) $$(OUTPUT_OPTION) $(1)
endef
define mescc.mes-c-compile-E
$(1:.$(CROSS)E=.$(CROSS)o): CROSS:=$(CROSS)
$(1:.$(CROSS)E=.$(CROSS)o): cc:=MESCC.mes
$(1:.$(CROSS)E=.$(CROSS)o): CC:=$(MESCC.mes)
$(1:.$(CROSS)E=.$(CROSS)o): CPPFLAGS:=$(2:%=-D %) $(3:%=-I %)
$(1:.$(CROSS)E=.$(CROSS)o): COMPILE.c:=$(MESCC.mes) -c $(CPPFLAGS)
$(1:.$(CROSS)E=.$(CROSS)o): OUT:=$(OUT)
$(1:.$(CROSS)E=.$(CROSS)o): $(MAKEFILE_LIST)
$(1:.$(CROSS)E=.$(CROSS)o): $(OUT)/mes
$(1:.$(CROSS)E=.$(CROSS)o): scripts/mes
$(1:.$(CROSS)E=.$(CROSS)o): $(INSTALL_MES_FILES)
$(1:.$(CROSS)E=.$(CROSS)o): $(1)
@echo " $$(cc) $$(notdir $(1)) -> $$(notdir $$@)"
@mkdir -p $$(dir $$@)
$$(QUIET)$$(COMPILE.c) $$(CPPFLAGS) $$(OUTPUT_OPTION) $(1)
endef
ifeq ($(MLIBC.mes),)
MLIBC.mes:=DONE
else
C_FILES:=$(filter-out libc/libc-mes.c,$(C_FILES))
endif
ifneq ($(MESC_DIRECT),)
$(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.mes-c-compile,$(c-file),$(DEFINES),$(INCLUDES))))
else
$(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.mes-c-preprocess,$(c-file),$(DEFINES),$(INCLUDES))))
$(foreach c-file,$(strip $(filter %.c,$(C_FILES))),$(eval $(call mescc.mes-c-compile-E,$(c-file:%.c=$(OUT)/%.$(CROSS)E),$(DEFINES),$(INCLUDES))))
endif
include make/reset.make