the top-level makefile.
+# 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 -Winline $(DEBUG)
+CFLAGS=-O2 -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wredundant-decls -Winline $(DEBUG) -std=gnu99
+
+# 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 ../libucw && pwd)
-all: bin/box bin/iwrapper bin/md5crypt bin/pedant
+export LIBUCW CFLAGS LDFLAGS DEBUG
+
+all: bin/box bin/iwrapper bin/md5crypt bin/pedant $(SUBMIT)
bin/%: src/%.o
$(CC) $(LDFLAGS) -o $@ $^
bin/md5crypt: src/md5crypt.o src/md5.o
bin/pedant: src/pedant.o
-clean:
+submit:
+
+clean::
rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core`
rm -f bin/box bin/iwrapper bin/md5crypt bin/pedant
distclean: clean
-.PHONY: all clean distclean
+ifdef SUBMIT
+
+submit:
+ $(MAKE) -C submit
+
+clean::
+ $(MAKE) -C submit clean
+
+endif
+
+.PHONY: all clean distclean submit
if [ -n "$REMOTE_SUBMIT" ] ; then
cp $H/submit/{contest,remote-submit,remote-status} bin/
- mkdir -p lib/perl5/{MO,Sherlock}
- cp $H/submit/MO/*.pm lib/perl5/MO/
- cp $H/submit/lib/perl5/Sherlock/Object.pm lib/perl5/Sherlock/
+ mkdir lib
+ cp -a $H/submit/lib .
fi
mkdir -p problems
TLSCF:=$(shell libgnutls-config --cflags)
TLSLF:=$(shell libgnutls-config --libs)
GCRCF:=$(shell libgcrypt-config --cflags)
-LIBUCW=../../libucw
-CFLAGS=-O2 -I$(LIBUCW)/include -g -Wall -W -Wno-parentheses -Wstrict-prototypes -Wmissing-prototypes -Wundef -Wredundant-decls -std=gnu99 $(TLSCF) $(GCRCF)
-LDFLAGS=$(TLSLF)
-
-#CC=gcc-4.1.1
-CFLAGS+=-Wno-pointer-sign -Wdisabled-optimization -Wno-missing-field-initializers
+CFLAGS+=-I$(LIBUCW)/include $(TLSCF) $(GCRCF)
+LDFLAGS+=$(TLSLF)
LDFLAGS+=-lpthread # FIXME: Use libucw without threads
-all: submitd privkey
+all: submitd privkey lib
submitd: submitd.o commands.o tasks.o $(LIBUCW)/lib/libsh.a $(LIBUCW)/lib/libucw.a
submitd.o: submitd.c submitd.h
certtool --generate-certificate --load-request client-req.pem --outfile client-cert.pem --load-ca-certificate ca-cert.pem --load-ca-privkey ca-key.pem --template client-cert.tpl
# Beware of serial numbers
+lib: .lib-stamp lib/perl5/MO/Submit.pm lib/perl5/Sherlock/Object.pm
+
+.lib-stamp:
+ mkdir -p lib/perl5/{MO,Sherlock}
+ touch .lib-stamp
+
+lib/perl5/MO/Submit.pm: MO/Submit.pm
+ cp $^ $@
+
+lib/perl5/Sherlock/Object.pm: $(LIBUCW)/lib/perl5/Sherlock/Object.pm
+ cp $^ $@
+
clean:
rm -f `find . -name "*~" -or -name "*.[oa]" -or -name "\#*\#" -or -name TAGS -or -name core -or -name .depend -or -name .#*`
rm -f submitd connect privkey
+ rm -rf lib .lib-stamp
+
+.PHONY: lib