-# Makefile for mo-eval and related utilities
-# (c) 2007 Martin Mares <mj@ucw.cz>
-
-VERSION=1.0.1
-#DEBUG=-ggdb
-CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wredundant-decls -Winline $(DEBUG) -std=gnu99
-
-#CC=gcc-4.1.1
-
-# Comment out if you are using a recent gcc
-CFLAGS+=-Wno-pointer-sign -Wdisabled-optimization -Wno-missing-field-initializers
-
-# Comment out if you do not wish to build remote submit utilities
-#SUBMIT=submit
-#LIBUCW:=$(shell cd ../holmes-libs-3.12/run && pwd)
-
-export LIBUCW CFLAGS LDFLAGS DEBUG
-
-all: bin/box bin/iwrapper bin/md5crypt bin/pedant $(SUBMIT)
-
-bin/%: src/%.o
- $(CC) $(LDFLAGS) -o $@ $^
-
-bin/box: src/box.o
-bin/iwrapper: src/iwrapper.o
-bin/md5crypt: src/md5crypt.o src/md5.o
-bin/pedant: src/pedant.o
-
-src/box.o: src/box.c src/syscall-table.h
-
-src/syscall-table.h:
- src/mk-syscall-table
-
-submit:
-
-clean::
- rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core`
- rm -f src/syscall-table.h
- rm -f bin/box bin/iwrapper bin/md5crypt bin/pedant
-
-distclean: clean
-
-ifdef SUBMIT
+# Makefile for Moe
+# (c) 2008--2012 Martin Mares <mj@ucw.cz>
+
+VERSION=1.0.99-20080220
+
+# The default target
+all: runtree programs datafiles configs
+
+# Include configuration
+s=.
+-include obj/config.mk
+obj/config.mk:
+ @echo "You need to run configure first." && false
+
+# We will use the libucw build system
+BUILDSYS=$(s)/build
+include $(BUILDSYS)/Maketop
+
+# Include makefiles of libraries we wish to use
+ifdef CONFIG_UCW_LIBS
+include $(s)/ucw/Makefile
+include $(s)/sherlock/Makefile
+# Disable built-in tests and documentation of these libraries
+TESTS=
+DOCS=
+DOC_INDICES=
+endif
-submit:
- $(MAKE) -C submit
+include $(s)/box/Makefile
+include $(s)/isolate/Makefile
+include $(s)/utils/Makefile
+include $(s)/eval/Makefile
+include $(s)/judge/Makefile
-clean::
- $(MAKE) -C submit clean
+ifdef CONFIG_SUBMIT
+include $(s)/submit/Makefile
+endif
+ifdef CONFIG_MOP
+include $(s)/mop/Makefile
endif
-.PHONY: all clean distclean submit
+# And finally the default rules of the build system
+include $(BUILDSYS)/Makebottom