From: Ben Pfaff Date: Wed, 3 Nov 2004 23:31:30 +0000 (+0000) Subject: Rework makefiles to work with older make. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=45bff6ea9a96f6ed8f51efdd8c5709a2b61b27dc;p=pintos-anon Rework makefiles to work with older make. --- diff --git a/grading/userprog/Make.base b/grading/userprog/Make.base new file mode 100644 index 0000000..365ef6c --- /dev/null +++ b/grading/userprog/Make.base @@ -0,0 +1,30 @@ +SRCDIR = ../../src + +PROGS = $(TESTS) child-simple child-arg child-bad child-close +child_simple_SRC = child-simple.c +child_arg_SRC = child-arg.c +child_bad_SRC = child-bad.c +child_close_SRC = child-close.c + +DISKS = $(patsubst %,%.dsk,$(TESTS)) + +disks: $(DISKS) + +exec-once.dsk exec-multiple.dsk join-simple.dsk join-twice.dsk: child-simple +exec-arg.dsk: child-arg +join-killed.dsk: child-bad +multi-child-fd.dsk: child-close + +%.dsk: % + ./prep-disk $< + +clean:: + rm -f $(DISKS) + +include $(SRCDIR)/Makefile.userprog + +CFLAGS += -Werror + +Makefile: Make.base Make.tests mkmf + ./mkmf + diff --git a/grading/userprog/Make.tests b/grading/userprog/Make.tests new file mode 100644 index 0000000..8df4071 --- /dev/null +++ b/grading/userprog/Make.tests @@ -0,0 +1,54 @@ +args-argc +args-argv0 +args-argvn +args-single +args-multiple +args-dbl-space +sc-bad-sp +sc-bad-arg +sc-boundary +halt +exit +create-normal +create-empty +create-null +create-bad-ptr +create-long +create-exists +create-bound +open-normal +open-missing +open-boundary +open-empty +open-null +open-bad-ptr +open-twice +close-normal +close-twice +close-stdin +close-stdout +close-bad-fd +read-normal +read-bad-ptr +read-boundary +read-zero +read-stdout +read-bad-fd +write-normal +write-bad-ptr +write-boundary +write-zero +write-stdin +write-bad-fd +exec-once +exec-arg +exec-multiple +exec-missing +exec-bad-ptr +join-simple +join-twice +join-killed +join-bad-pid +multi-recurse +multi-oom +multi-child-fd diff --git a/grading/userprog/Makefile b/grading/userprog/Makefile index e49f6d6..0a09f5a 100644 --- a/grading/userprog/Makefile +++ b/grading/userprog/Makefile @@ -1,35 +1,85 @@ -SRCDIR = ../../src +# This file is automatically generated from Make.base and Make.tests +# by mkmf. Do not modify! -# Main test programs. TESTS = \ - $(addprefix args-, argc argv0 argvn single multiple dbl-space) \ - $(addprefix sc-, bad-sp bad-arg boundary) \ - halt exit \ - $(addprefix create-, normal empty null bad-ptr long exists bound) \ - $(addprefix open-, normal missing boundary empty null bad-ptr twice) \ - $(addprefix close-, normal twice stdin stdout bad-fd) \ - $(addprefix read-, normal bad-ptr boundary zero stdout bad-fd) \ - $(addprefix write-, normal bad-ptr boundary zero stdin bad-fd) \ - $(addprefix exec-, once arg multiple missing bad-ptr) \ - $(addprefix join-, simple twice killed bad-pid) \ - $(addprefix multi-, recurse oom child-fd) - -define TEST_PROG -PROGS += $(1) -$(subst -,_,$(1))_SRC = $(1).c -endef - -$(foreach prog,$(TESTS),$(eval $(call TEST_PROG,$(prog)))) -DISKS = $(patsubst %,%.dsk,$(PROGS)) + args-argc args-argv0 args-argvn args-single args-multiple \ + args-dbl-space sc-bad-sp sc-bad-arg sc-boundary halt exit \ + create-normal create-empty create-null create-bad-ptr create-long \ + create-exists create-bound open-normal open-missing open-boundary \ + open-empty open-null open-bad-ptr open-twice close-normal \ + close-twice close-stdin close-stdout close-bad-fd read-normal \ + read-bad-ptr read-boundary read-zero read-stdout read-bad-fd \ + write-normal write-bad-ptr write-boundary write-zero write-stdin \ + write-bad-fd exec-once exec-arg exec-multiple exec-missing \ + exec-bad-ptr join-simple join-twice join-killed join-bad-pid \ + multi-recurse multi-oom multi-child-fd +args_argc_SRC = args-argc.c +args_argv0_SRC = args-argv0.c +args_argvn_SRC = args-argvn.c +args_single_SRC = args-single.c +args_multiple_SRC = args-multiple.c +args_dbl_space_SRC = args-dbl-space.c +sc_bad_sp_SRC = sc-bad-sp.c +sc_bad_arg_SRC = sc-bad-arg.c +sc_boundary_SRC = sc-boundary.c +halt_SRC = halt.c +exit_SRC = exit.c +create_normal_SRC = create-normal.c +create_empty_SRC = create-empty.c +create_null_SRC = create-null.c +create_bad_ptr_SRC = create-bad-ptr.c +create_long_SRC = create-long.c +create_exists_SRC = create-exists.c +create_bound_SRC = create-bound.c +open_normal_SRC = open-normal.c +open_missing_SRC = open-missing.c +open_boundary_SRC = open-boundary.c +open_empty_SRC = open-empty.c +open_null_SRC = open-null.c +open_bad_ptr_SRC = open-bad-ptr.c +open_twice_SRC = open-twice.c +close_normal_SRC = close-normal.c +close_twice_SRC = close-twice.c +close_stdin_SRC = close-stdin.c +close_stdout_SRC = close-stdout.c +close_bad_fd_SRC = close-bad-fd.c +read_normal_SRC = read-normal.c +read_bad_ptr_SRC = read-bad-ptr.c +read_boundary_SRC = read-boundary.c +read_zero_SRC = read-zero.c +read_stdout_SRC = read-stdout.c +read_bad_fd_SRC = read-bad-fd.c +write_normal_SRC = write-normal.c +write_bad_ptr_SRC = write-bad-ptr.c +write_boundary_SRC = write-boundary.c +write_zero_SRC = write-zero.c +write_stdin_SRC = write-stdin.c +write_bad_fd_SRC = write-bad-fd.c +exec_once_SRC = exec-once.c +exec_arg_SRC = exec-arg.c +exec_multiple_SRC = exec-multiple.c +exec_missing_SRC = exec-missing.c +exec_bad_ptr_SRC = exec-bad-ptr.c +join_simple_SRC = join-simple.c +join_twice_SRC = join-twice.c +join_killed_SRC = join-killed.c +join_bad_pid_SRC = join-bad-pid.c +multi_recurse_SRC = multi-recurse.c +multi_oom_SRC = multi-oom.c +multi_child_fd_SRC = multi-child-fd.c -disks: $(DISKS) +SRCDIR = ../../src -# Other programs needed by some of the main test programs. -PROGS += child-simple child-arg child-bad child-close +PROGS = $(TESTS) child-simple child-arg child-bad child-close child_simple_SRC = child-simple.c child_arg_SRC = child-arg.c child_bad_SRC = child-bad.c child_close_SRC = child-close.c + +DISKS = $(patsubst %,%.dsk,$(TESTS)) + +disks: $(DISKS) + exec-once.dsk exec-multiple.dsk join-simple.dsk join-twice.dsk: child-simple exec-arg.dsk: child-arg join-killed.dsk: child-bad @@ -44,3 +94,7 @@ clean:: include $(SRCDIR)/Makefile.userprog CFLAGS += -Werror + +Makefile: Make.base Make.tests mkmf + ./mkmf + diff --git a/grading/userprog/mkmf b/grading/userprog/mkmf new file mode 100755 index 0000000..a45ee56 --- /dev/null +++ b/grading/userprog/mkmf @@ -0,0 +1,48 @@ +#! /usr/bin/perl -w + +use strict; + +my (@tests); + +open (TESTS, ") { + chomp; + /^#/ || /^\s+$/ and next; + s/\s//g; + push (@tests, $_); +} +close (TESTS); + +open (MAKEBASE, "Makefile") or die; +print MAKEFILE <) { + print MAKEFILE $_; +} +close (MAKEBASE); +