2015-08-21 10:04:50 +03:00
|
|
|
# Makefile for QEMU - modified for Unicorn engine.
|
|
|
|
|
|
|
|
# Always point to the root of the build tree (needs GNU make).
|
|
|
|
BUILD_DIR=$(CURDIR)
|
|
|
|
|
|
|
|
# All following code might depend on configuration variables
|
|
|
|
ifneq ($(wildcard config-host.mak),)
|
|
|
|
# Put the all: rule here so that config-host.mak can contain dependencies.
|
|
|
|
all:
|
|
|
|
include config-host.mak
|
|
|
|
|
|
|
|
# Check that we're not trying to do an out-of-tree build from
|
|
|
|
# a tree that's been used for an in-tree build.
|
|
|
|
ifneq ($(realpath $(SRC_PATH)),$(realpath .))
|
|
|
|
ifneq ($(wildcard $(SRC_PATH)/config-host.mak),)
|
|
|
|
$(error This is an out of tree build but your source tree ($(SRC_PATH)) \
|
|
|
|
seems to have been used for an in-tree build. You can fix this by running \
|
|
|
|
"make distclean && rm -rf *-linux-user *-softmmu" in your source tree)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
CONFIG_SOFTMMU := $(if $(filter %-softmmu,$(TARGET_DIRS)),y)
|
|
|
|
-include config-all-devices.mak
|
|
|
|
|
|
|
|
include $(SRC_PATH)/rules.mak
|
|
|
|
config-host.mak: $(SRC_PATH)/configure
|
|
|
|
@echo $@ is out-of-date, running configure
|
|
|
|
else
|
|
|
|
config-host.mak:
|
|
|
|
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
|
|
|
@echo "Please call configure before running make!"
|
|
|
|
@exit 1
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
GENERATED_HEADERS = config-host.h
|
|
|
|
|
|
|
|
# Don't try to regenerate Makefile or configure
|
|
|
|
# We don't generate any of them
|
|
|
|
Makefile: ;
|
|
|
|
configure: ;
|
|
|
|
|
2020-04-28 08:50:50 +03:00
|
|
|
.PHONY: all clean distclean recurse-all
|
2015-08-21 10:04:50 +03:00
|
|
|
|
|
|
|
$(call set-vpath, $(SRC_PATH))
|
|
|
|
|
|
|
|
SUBDIR_MAKEFLAGS=$(if $(V),,--no-print-directory) BUILD_DIR=$(BUILD_DIR)
|
|
|
|
SUBDIR_DEVICES_MAK=$(patsubst %, %/config-devices.mak, $(TARGET_DIRS))
|
|
|
|
SUBDIR_DEVICES_MAK_DEP=$(patsubst %, %-config-devices.mak.d, $(TARGET_DIRS))
|
|
|
|
|
|
|
|
ifeq ($(SUBDIR_DEVICES_MAK),)
|
|
|
|
config-all-devices.mak:
|
|
|
|
$(call quiet-command,echo '# no devices' > $@," GEN $@")
|
|
|
|
else
|
|
|
|
config-all-devices.mak: $(SUBDIR_DEVICES_MAK)
|
|
|
|
$(call quiet-command, sed -n \
|
|
|
|
's|^\([^=]*\)=\(.*\)$$|\1:=$$(findstring y,$$(\1)\2)|p' \
|
|
|
|
$(SUBDIR_DEVICES_MAK) | sort -u > $@, \
|
|
|
|
" GEN $@")
|
|
|
|
endif
|
|
|
|
|
|
|
|
-include $(SUBDIR_DEVICES_MAK_DEP)
|
|
|
|
|
|
|
|
%/config-devices.mak: default-configs/%.mak
|
2020-04-28 04:39:10 +03:00
|
|
|
$(call quiet-command, cp $< $@, " GEN $@")
|
2015-08-21 10:04:50 +03:00
|
|
|
|
|
|
|
ifneq ($(wildcard config-host.mak),)
|
|
|
|
include $(SRC_PATH)/Makefile.objs
|
|
|
|
endif
|
|
|
|
|
2020-04-27 21:38:51 +03:00
|
|
|
dummy := $(call unnest-vars,,util-obj-y common-obj-y)
|
2015-08-21 10:04:50 +03:00
|
|
|
|
2020-04-28 08:30:18 +03:00
|
|
|
all: recurse-all
|
2015-08-21 10:04:50 +03:00
|
|
|
|
|
|
|
config-host.h: config-host.h-timestamp
|
|
|
|
config-host.h-timestamp: config-host.mak
|
|
|
|
|
|
|
|
SUBDIR_RULES=$(patsubst %,subdir-%, $(TARGET_DIRS))
|
|
|
|
SOFTMMU_SUBDIR_RULES=$(filter %-softmmu,$(SUBDIR_RULES))
|
|
|
|
|
|
|
|
$(SOFTMMU_SUBDIR_RULES): config-all-devices.mak
|
|
|
|
|
|
|
|
subdir-%:
|
|
|
|
$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C $* V="$(V)" TARGET_DIR="$*/" all,)
|
|
|
|
|
2020-06-06 22:53:10 +03:00
|
|
|
$(SUBDIR_RULES): $(common-obj-y) $(util-obj-y)
|
2015-08-21 10:04:50 +03:00
|
|
|
|
|
|
|
recurse-all: $(SUBDIR_RULES)
|
|
|
|
|
|
|
|
######################################################################
|
|
|
|
|
|
|
|
clean:
|
|
|
|
find . \( -name '*.l[oa]' -o -name '*.so' -o -name '*.dll' -o -name '*.mo' -o -name '*.[oda]' \) -type f -exec rm {} +
|
2020-04-28 08:50:50 +03:00
|
|
|
rm -f TAGS *~ */*~
|
2015-08-21 10:04:50 +03:00
|
|
|
@# May not be present in GENERATED_HEADERS
|
|
|
|
rm -f $(foreach f,$(GENERATED_HEADERS),$(f) $(f)-timestamp)
|
2020-04-28 08:30:18 +03:00
|
|
|
for d in $(TARGET_DIRS); do \
|
2015-08-21 10:04:50 +03:00
|
|
|
if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
|
|
|
|
done
|
|
|
|
|
|
|
|
distclean: clean
|
2020-04-28 08:30:18 +03:00
|
|
|
rm -f config-host.mak config-host.h*
|
|
|
|
rm -f config-all-devices.mak
|
2020-04-28 08:50:50 +03:00
|
|
|
rm -f config.log config.status
|
2015-08-21 10:04:50 +03:00
|
|
|
for d in $(TARGET_DIRS); do \
|
|
|
|
rm -rf $$d || exit 1 ; \
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# Add a dependency on the generated files, so that they are always
|
|
|
|
# rebuilt before other object files
|
|
|
|
ifneq ($(filter-out %clean,$(MAKECMDGOALS)),$(if $(MAKECMDGOALS),,fail))
|
|
|
|
Makefile: $(GENERATED_HEADERS)
|
|
|
|
endif
|
|
|
|
|