mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[make] Rename OUTPUT_DIRECTORY to build_dir
This commit is contained in:
committed by
LeaNumworks
parent
2af792cf88
commit
bd6339f9dc
30
Makefile
30
Makefile
@@ -3,23 +3,23 @@ include scripts/config.mak
|
||||
# Disable default Make rules
|
||||
.SUFFIXES:
|
||||
|
||||
OUTPUT_DIRECTORY = outputs
|
||||
object_for = $(addprefix $(OUTPUT_DIRECTORY)/,$(addsuffix .o,$(basename $(1))))
|
||||
build_dir = build
|
||||
object_for = $(addprefix $(build_dir)/,$(addsuffix .o,$(basename $(1))))
|
||||
|
||||
default: $(OUTPUT_DIRECTORY)/epsilon.$(EXE)
|
||||
default: $(build_dir)/epsilon.$(EXE)
|
||||
|
||||
# Define a standard rule helper
|
||||
# If passed a last parameter value of with_local_version, we also define an
|
||||
# extra rule that can build source files within the $(OUTPUT_DIRECTORY). This is
|
||||
# useful for rules that can be applied for intermediate objects (for example,
|
||||
# when going .png -> .cpp -> .o).
|
||||
# extra rule that can build source files within the $(build_dir). This is useful
|
||||
# for rules that can be applied for intermediate objects (for example, when
|
||||
# going .png -> .cpp -> .o).
|
||||
define rule_for
|
||||
$(addprefix $$(OUTPUT_DIRECTORY)/,$(strip $(2))): $(strip $(3)) | $$$$(@D)/.
|
||||
@ echo "$(shell printf "%-8s" $(strip $(1)))$$(@:$$(OUTPUT_DIRECTORY)/%=%)"
|
||||
$(addprefix $$(build_dir)/,$(strip $(2))): $(strip $(3)) | $$$$(@D)/.
|
||||
@ echo "$(shell printf "%-8s" $(strip $(1)))$$(@:$$(build_dir)/%=%)"
|
||||
$(Q) $(4)
|
||||
ifeq ($(strip $(5)),with_local_version)
|
||||
$(addprefix $$(OUTPUT_DIRECTORY)/,$(strip $(2))): $(addprefix $$(OUTPUT_DIRECTORY)/,$(strip $(3)))
|
||||
@ echo "$(shell printf "%-8s" $(strip $(1)))$$(@:$$(OUTPUT_DIRECTORY)/%=%)"
|
||||
$(addprefix $$(build_dir)/,$(strip $(2))): $(addprefix $$(build_dir)/,$(strip $(3)))
|
||||
@ echo "$(shell printf "%-8s" $(strip $(1)))$$(@:$$(build_dir)/%=%)"
|
||||
$(Q) $(4)
|
||||
endif
|
||||
endef
|
||||
@@ -37,8 +37,8 @@ info:
|
||||
# "output/foo/bar.o" because the directory "output/foo" doesn't exist).
|
||||
# We need to mark those directories as precious, otherwise Make will try to get
|
||||
# rid of them upon completion (and fail, since those folders won't be empty).
|
||||
.PRECIOUS: $(OUTPUT_DIRECTORY)/. $(OUTPUT_DIRECTORY)%/.
|
||||
$(OUTPUT_DIRECTORY)/. $(OUTPUT_DIRECTORY)%/.:
|
||||
.PRECIOUS: $(build_dir)/. $(build_dir)%/.
|
||||
$(build_dir)/. $(build_dir)%/.:
|
||||
$(Q) mkdir -p $(dir $@)
|
||||
|
||||
# To make objects dependent on their directory, we need a second expansion
|
||||
@@ -75,8 +75,8 @@ objs = $(call object_for,$(src))
|
||||
-include $(objs:.o=.d)
|
||||
|
||||
.SECONDARY: $(objs)
|
||||
$(OUTPUT_DIRECTORY)/epsilon.$(EXE): $(objs)
|
||||
$(OUTPUT_DIRECTORY)/test.$(EXE): $(objs)
|
||||
$(build_dir)/epsilon.$(EXE): $(objs)
|
||||
$(build_dir)/test.$(EXE): $(objs)
|
||||
|
||||
# Define standard compilation rules
|
||||
|
||||
@@ -105,7 +105,7 @@ $(eval $(call rule_for, \
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "CLEAN"
|
||||
$(Q) rm -rf $(OUTPUT_DIRECTORY)
|
||||
$(Q) rm -rf $(build_dir)
|
||||
|
||||
.PHONY: cowsay_%
|
||||
cowsay_%:
|
||||
|
||||
@@ -47,7 +47,7 @@ $(call object_for,apps/apps_container_storage.cpp apps/main.cpp): CXXFLAGS += $(
|
||||
# I18n file generation
|
||||
|
||||
# The header is refered to as <apps/i18n.h> so make sure it's findable this way
|
||||
SFLAGS += -I$(OUTPUT_DIRECTORY)
|
||||
SFLAGS += -I$(build_dir)
|
||||
|
||||
i18n_files += $(addprefix apps/language_,$(addsuffix .universal.i18n, $(EPSILON_I18N)))
|
||||
i18n_files += $(addprefix apps/,\
|
||||
@@ -81,9 +81,9 @@ $(eval $(call rule_for, \
|
||||
# by the object_for function.
|
||||
app_src += apps/i18n.py
|
||||
|
||||
$(OUTPUT_DIRECTORY)/apps/i18n.h: $(OUTPUT_DIRECTORY)/apps/i18n.cpp
|
||||
$(build_dir)/apps/i18n.h: $(build_dir)/apps/i18n.cpp
|
||||
|
||||
$(call object_for,$(app_src)): $(OUTPUT_DIRECTORY)/apps/i18n.h
|
||||
$(call object_for,$(app_src)): $(build_dir)/apps/i18n.h
|
||||
|
||||
# Handle PNG files
|
||||
|
||||
@@ -96,8 +96,8 @@ $(eval $(call depends_on_image,apps/title_bar_view.cpp,apps/exam_icon.png))
|
||||
# As a shortcut, we simply say that every app file depends on every image. In
|
||||
# practice, this forces all the images to be before the app.
|
||||
|
||||
#app_image_objs := $(OUTPUT_DIRECTORY)/$(app_images:.png=.o)
|
||||
#.SECONDARY: $(OUTPUT_DIRECTORY)/$(app_images:.png=.cpp)
|
||||
#app_image_objs := $(build_dir)/$(app_images:.png=.o)
|
||||
#.SECONDARY: $(build_dir)/$(app_images:.png=.cpp)
|
||||
#$(app_objs): $(app_image_objs)
|
||||
#app_image_src := $(app_images:.png=.cpp)
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ $(eval $(call rule_for, \
|
||||
$$(HOSTCC) -std=c99 `libpng-config --cflags` $$^ `libpng-config --ldflags` -o $$@ \
|
||||
))
|
||||
|
||||
INLINER := $(OUTPUT_DIRECTORY)/escher/image/inliner
|
||||
INLINER := $(build_dir)/escher/image/inliner
|
||||
|
||||
.PRECIOUS: $(OUTPUT_DIRECTORY)/%.h $(OUTPUT_DIRECTORY)/%.cpp
|
||||
.PRECIOUS: $(build_dir)/%.h $(build_dir)/%.cpp
|
||||
$(eval $(call rule_for, \
|
||||
INLINER, \
|
||||
%.h %.cpp, \
|
||||
|
||||
@@ -41,10 +41,10 @@ src += $(addprefix ion/src/device/, \
|
||||
|
||||
ifneq ($(DEBUG),1)
|
||||
ifneq ($(COMPILER),llvm)
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/led.o: SFLAGS+=-O3
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/console.o: SFLAGS+=-O3
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/display.o: SFLAGS+=-O3
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/swd.o: SFLAGS+=-O3
|
||||
$(build_dir)/ion/src/device/led.o: SFLAGS+=-O3
|
||||
$(build_dir)/ion/src/device/console.o: SFLAGS+=-O3
|
||||
$(build_dir)/ion/src/device/display.o: SFLAGS+=-O3
|
||||
$(build_dir)/ion/src/device/swd.o: SFLAGS+=-O3
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
@@ -52,8 +52,8 @@ dfu_src += ion/src/device/base64.cpp
|
||||
dfu_src += ion/src/device/flash.cpp
|
||||
dfu_src += ion/src/device/timing.cpp
|
||||
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/usb/dfu.elf: LDSCRIPT = ion/src/device/usb/dfu.ld
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/usb/dfu.elf: $(call object_for,$(usb_src)) $(call object_for,$(dfu_src))
|
||||
$(build_dir)/ion/src/device/usb/dfu.elf: LDSCRIPT = ion/src/device/usb/dfu.ld
|
||||
$(build_dir)/ion/src/device/usb/dfu.elf: $(call object_for,$(usb_src)) $(call object_for,$(dfu_src))
|
||||
|
||||
# This command embeds a binary file into an object one.
|
||||
# This allows us to embed standalone code (the dfu routines) into the final
|
||||
@@ -62,7 +62,7 @@ $(OUTPUT_DIRECTORY)/ion/src/device/usb/dfu.elf: $(call object_for,$(usb_src)) $(
|
||||
# and end), but prefixes them with a mangled file path. To have consistent names
|
||||
# we simply "cd" into the directory. This assumes input and output lives in the
|
||||
# same directory.
|
||||
$(OUTPUT_DIRECTORY)/ion/src/device/usb/dfu.o: $(OUTPUT_DIRECTORY)/ion/src/device/usb/dfu.bin
|
||||
$(build_dir)/ion/src/device/usb/dfu.o: $(build_dir)/ion/src/device/usb/dfu.bin
|
||||
@echo "OBJCOPY $@"
|
||||
$(Q) cd $(dir $<) ; $(OBJCOPY) -I binary -O elf32-littlearm -B arm --rename-section .data=.rodata --redefine-sym _binary_dfu_bin_start=_dfu_bootloader_flash_start --redefine-sym _binary_dfu_bin_end=_dfu_bootloader_flash_end $(notdir $<) $(notdir $@)
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ $(eval $(call rule_for, \
|
||||
$$(HOSTCC) $$(RASTERIZER_CFLAGS) $$^ $$(RASTERIZER_LDFLAGS) -o $$@ \
|
||||
))
|
||||
|
||||
RASTERIZER := $(OUTPUT_DIRECTORY)/kandinsky/fonts/rasterizer
|
||||
RASTERIZER := $(build_dir)/kandinsky/fonts/rasterizer
|
||||
|
||||
$(eval $(call rule_for, \
|
||||
RASTER, \
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SFLAGS += -Ipython/src
|
||||
SFLAGS += -Ipython/port
|
||||
SFLAGS += -I$(OUTPUT_DIRECTORY)/python/port
|
||||
SFLAGS += -I$(build_dir)/python/port
|
||||
|
||||
# How to maintain this Makefile
|
||||
# - Copy PY_CORE_O_BASENAME from py.mk into py_objs
|
||||
@@ -177,6 +177,6 @@ $(eval $(call rule_for, \
|
||||
$$(PYTHON) python/src/py/makeqstrdata.py $$< > $$@ \
|
||||
))
|
||||
|
||||
$(call object_for,$(python_src)): $(OUTPUT_DIRECTORY)/python/port/genhdr/qstrdefs.generated.h
|
||||
$(call object_for,$(python_src)): $(build_dir)/python/port/genhdr/qstrdefs.generated.h
|
||||
|
||||
src += $(python_src)
|
||||
|
||||
Reference in New Issue
Block a user