Jelajahi Sumber

fixup! Add first version of ninja based build system

Wictor Lund 4 tahun lalu
induk
melakukan
ff2fa9276a
2 mengubah file dengan 40 tambahan dan 0 penghapusan
  1. 16 0
      symon/symux/build.ninja
  2. 24 0
      symon/symux/gen_conf.sh

+ 16 - 0
symon/symux/build.ninja

@@ -0,0 +1,16 @@
+cdir = $cdir/symux
+
+cflags = $cflags -I$rdir/lib -I$rrddir/include -I$pdir -I$cdir
+ldflags = $ldflags $symux_libs -L$rdir/lib -L$rrddir/lib -lrrd
+
+build $cdir/symux.o: cc $cdir/symux.c
+build $cdir/readconf.o: cc $cdir/readconf.c
+build $cdir/symuxnet.o: cc $cdir/symuxnet.c
+build $cdir/share.o: cc $cdir/share.c
+
+build $cdir/conf.h: run_script $cdir/gen_conf.sh
+  env = SYSCONFDIR=$sysconfdir V=$v OS=$platform PDIR=$pdir
+
+build $cdir/symux: link $cdir/symux.o $cdir/readconf.o $cdir/symuxnet.o $cdir/share.o $rdir/lib/libsym.a
+
+# TODO: install

+ 24 - 0
symon/symux/gen_conf.sh

@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -euC
+
+if [ "$#" -ne 1 ]; then
+	echo "Wrong number of arguments" >&2
+	exit 1
+fi
+
+output="$1"
+
+[ -f "$1" ] && rm "$output"
+
+cat > "$output" <<EOF
+/* This file was automagically generated by $0 */
+#define SYMUX_CONFIG_FILE "${SYSCONFDIR}/symux.conf"
+#define SYMUX_VERSION "${V}"
+#define SYMUX_PLATFORM "${OS}"
+#include "platform.h"
+EOF
+
+if [ -f $PDIR/conf.sh ]; then 
+	/bin/sh $PDIR/conf.sh >> "$output"
+fi