diff options
author | LAN-TW <lantw44@gmail.com> | 2013-11-04 22:32:44 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2013-11-04 22:32:44 +0800 |
commit | f92962990ee4d98923f4a457c21e0c03d9c22722 (patch) | |
tree | a90ac657a7a6817896323d553030d735fb7cd345 /hw2 | |
parent | 2f5c01991bb93ec44624b9b45edb130ad0bd6a36 (diff) | |
download | sp2013-f92962990ee4d98923f4a457c21e0c03d9c22722.tar.gz sp2013-f92962990ee4d98923f4a457c21e0c03d9c22722.tar.zst sp2013-f92962990ee4d98923f4a457c21e0c03d9c22722.zip |
HW2: Add build system files
Diffstat (limited to 'hw2')
-rw-r--r-- | hw2/Makefile.am | 20 | ||||
-rwxr-xr-x | hw2/autogen.sh | 51 | ||||
-rw-r--r-- | hw2/configure.ac | 26 |
3 files changed, 97 insertions, 0 deletions
diff --git a/hw2/Makefile.am b/hw2/Makefile.am new file mode 100644 index 0000000..335e578 --- /dev/null +++ b/hw2/Makefile.am @@ -0,0 +1,20 @@ +EXTRA_DIST = README.txt +bin_PROGRAMS = big_judge judge player +noinst_LIBRARIES = libsphw2.a +libsphw2_a_SOURCES = xwrap.c xwrap.h +big_judge_SOURCES = big_judge.c +big_judge_LDADD = $(top_builddir)/libsphw2.a +judge_SOURCES = judge.c +judge_LDADD = $(top_builddir)/libsphw2.a +player_SOURCES = player.c +player_LDADD = $(top_builddir)/libsphw2.a + +submit_tarball_name=SPHW2_b01902062.tar.gz +submit_dir_name=b01902062 + +submit: $(submit_tarball_name) +$(submit_tarball_name): $(PACKAGE)-$(VERSION).tar.gz + tar -zxf $(PACKAGE)-$(VERSION).tar.gz + mv $(PACKAGE)-$(VERSION) $(submit_dir_name) + tar -zcf $(submit_tarball_name) $(submit_dir_name) + rm -rf $(submit_dir_name) diff --git a/hw2/autogen.sh b/hw2/autogen.sh new file mode 100755 index 0000000..a15abd9 --- /dev/null +++ b/hw2/autogen.sh @@ -0,0 +1,51 @@ +#!/bin/sh + +map_c_filename () +{ + c_filename="`basename $1`" + case "$c_filename" in + "d1array.c") echo "basic-array.c" ;; + "d1arrstr.c") echo "basic-arrstr.c" ;; + "d2array.c") echo "basic-array2.c" ;; + "list.c") echo "basic-list.c" ;; + "toargv.c") echo "basic-argv.c" ;; + "qarg.c") echo "basic-qarg.c" ;; + *) echo "$c_filename" ;; + esac +} + +map_h_filename () +{ + h_filename="`basename $1`" + case "$h_filename" in + "l4darr.h") echo "basic-array.h" ;; + "l4bds.h") echo "basic-list.h" ;; + "l4arg.h") echo "basic-arg.h" ;; + *) echo "$h_filename" ;; + esac +} + +generate_file () +{ + file_src="$1" + case "$file_src" in + *.c) file_dest="`map_c_filename $file_src`" ;; + *.h) file_dest="`map_h_filename $file_src`" ;; + esac + [ -z "$file_dest" ] && return 1 + + echo "Generating $file_dest from $file_src" + sed -f "libbasic.sed" "$file_src" > "$file_dest" +} + +autoreconf -iv +[ -z "$1" ] && exit 0 + +git clone "$1" "l4basic" + +for i in l4basic/l4darr/*.[ch] l4basic/l4bds/*.[ch] l4basic/l4arg/*.[ch] +do + generate_file "$i" "." +done + +rm -rf "l4basic" diff --git a/hw2/configure.ac b/hw2/configure.ac new file mode 100644 index 0000000..61406f0 --- /dev/null +++ b/hw2/configure.ac @@ -0,0 +1,26 @@ +# -*- Autoconf -*- +# Process this file with autoconf to produce a configure script. + +AC_INIT([sphw-b01902062], [2]) +AC_CONFIG_SRCDIR([big_judge.c]) +AC_CONFIG_HEADERS([config.h]) + +AM_INIT_AUTOMAKE([foreign]) +AM_SILENT_RULES([yes]) + +# Checks for programs. +AC_PROG_CC +AC_PROG_CC_C99 +AC_C_VOLATILE +AC_PROG_RANLIB + +# Checks for typedefs, structures, and compiler characteristics. +AC_CHECK_HEADER_STDBOOL +AC_TYPE_SIZE_T +AC_TYPE_SSIZE_T + +# Checks for library functions. +AC_FUNC_MALLOC + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT |