Rewrite Makefiles to be closer to doing The Right Thing(tm)

This commit is contained in:
Brian J. Burg 2012-09-24 14:54:59 -07:00
parent b1ef70b402
commit 0b42b7f537
6 changed files with 299 additions and 392 deletions

35
mk/check.mk Normal file
View file

@ -0,0 +1,35 @@
define DEF_SUBMODULE_TEST_RULES
# check target
check-$(1) : $$(DONE_$(1))
@$$(call E, make check: $(1))
$$(Q) \
$$(ENV_CFLAGS_$(1)) \
$$(ENV_RFLAGS_$(1)) \
$$(MAKE) -C $$(B)src/$(1) check
DEPS_CLEAN += clean-$(1)
endef
$(foreach submodule,$(CFG_SUBMODULES),\
$(eval $(call DEF_SUBMODULE_TEST_RULES,$(submodule))))
# Testing targets
servo-test: $(DEPS_servo)
$(CFG_RUSTC) $(RFLAGS_servo) --test -o $@ $<
reftest: src/reftest/reftest.rs servo
$(CFG_RUSTC) $(RFLAGS_servo) -o $@ $< -L .
.PHONY: check $(DEPS_CHECK)
check: $(CHECK_DEPS) check-servo
check-servo: servo-test
./servo-test $(TESTNAME)
check-ref: reftest
./reftest --source-dir=$(VPATH)/src/test/ref --work-dir=src/test/ref $(TESTNAME)

20
mk/clean.mk Normal file
View file

@ -0,0 +1,20 @@
define DEF_SUBMODULE_CLEAN_RULES
# clean target
clean-$(1) :
@$$(call E, make clean: $(1))
$$(Q)rm -f $$(DONE_$(1))
$$(Q)$$(MAKE) -C $$(B)src/$(1) clean
# add these targets to meta-targets
DEPS_CLEAN += clean-$(1)
endef
$(foreach submodule,$(CFG_SUBMODULES),\
$(eval $(call DEF_SUBMODULE_CLEAN_RULES,$(submodule))))
.PHONY: clean $(DEPS_CLEAN)
clean: $(DEPS_CLEAN) clean-servo
clean-servo:
rm -f servo servo-test

48
mk/sub.mk Normal file
View file

@ -0,0 +1,48 @@
DEPS_rust-azure += \
rust-geom
DEPS_rust-glut += \
rust-opengles
DEPS_rust-layers += \
rust-geom \
rust-opengles \
rust-glut \
rust-azure
DEPS_sharegl += \
rust-opengles \
rust-geom
DEPS_servo-sandbox += \
libhubbub \
libparserutils
DEPS_rust-hubbub += \
libhubbub
CFLAGS_mozjs += \
"-I../mozjs/dist/include"
DEPS_rust-mozjs += \
mozjs
CFLAGS_rust-mozjs += \
"-I../mozjs/dist/include"
# Platform-specific dependencies
ifeq ($(CFG_OSTYPE),darwin)
DEPS_rust-azure += \
rust-cocoa \
rust-core-foundation
DEPS_rust-layers += \
rust-cocoa
DEPS_rust-io-surface += \
rust-core-foundation
DEPS_sharegl += \
rust-core-foundation \
rust-io-surface
endif