aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nnoll523@gmail.com>2020-06-20 13:32:11 -0700
committerNicholas Noll <nnoll523@gmail.com>2020-06-20 13:32:11 -0700
commitdb8e974d48b8a9de58f660f159a780dce2992bb7 (patch)
tree5e0c6a6eafe015edc2d029f82473efc1b7483f1e
parent8177d942ac3fbb35ce84fb66b828d1b78a0ef6cd (diff)
fix: added file to make bootstrapping on new device easier. small changes to accomodate
-rwxr-xr-xinit57
-rw-r--r--rules.mk15
-rw-r--r--sys/cmd/dwm/rules.mk5
-rw-r--r--sys/cmd/ic/.gitignore3
-rw-r--r--sys/cmd/ic/ic.c2
-rw-r--r--sys/cmd/ic/rules.mk2
-rw-r--r--sys/libmath/rules.mk3
7 files changed, 71 insertions, 16 deletions
diff --git a/init b/init
new file mode 100755
index 0000000..32b810d
--- /dev/null
+++ b/init
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+# this script should only be run once per initialization of the repo
+# it's job is to pull in code external to the source tree
+# after it completes, simply run make
+
+# TODO: set up cross compiling directories
+
+inc=$PWD/include/vendor
+lib=$PWD/lib
+root=$PWD
+
+if [ -d vendor -a -z $1 ]; then
+ echo already initialized, remove vendor directory or force argument to rerun
+else
+ # setup directories
+ mkdir -p vendor 1>&2 2>/dev/null
+ mkdir -p $lib 1>&2 2>/dev/null
+ mkdir -p $inc 1>&2 2>/dev/null
+
+ # install musl
+ # dependencies: nil
+ if [ -d $inc/libc ]; then
+ echo libc found, skipping
+ else
+ git clone git://git.musl-libc.org/musl vendor/musl
+ cd vendor/musl && ./configure && make
+
+ cp -r obj/include $inc/libc
+ cp -r obj/crt $lib/crt
+ cp -r lib/*.a $lib
+ fi
+
+ cd $root
+
+ # install OpenBLAS
+ # dependencies: gfortran
+ # warning: this is a _monster_
+ if [ -d $inc/blas ]; then
+ echo blas found, skipping
+ else
+ git clone https://github.com/xianyi/OpenBLAS.git vendor/blas
+ cd vendor/blas && make USE_THREAD=0 -j4
+
+ cp libopenblas_*.a $lib/libblas.a
+ mkdir -p $inc/blas
+ cp cblas.h common*.h config.h param.h $inc/blas
+
+ # install LAPACKE ...ugh...
+ cd lapack-netlib && cp make.inc.example make.inc && make -j4
+ cd LAPACKE && make && cd ..
+ cp liblapack.a liblapacke.a $lib
+ cp LAPACKE/include/lapack*.h $inc/blas
+ fi
+
+ cd $root
+fi
diff --git a/rules.mk b/rules.mk
index 43fe31b..0004eb2 100644
--- a/rules.mk
+++ b/rules.mk
@@ -42,11 +42,16 @@ $(OBJ_DIR)/%: $(SRC_DIR)/%.c
targets: $(LIBS) $(BINS) $(UNTS)
clean:
- rm -f $(OBJS)
- rm -f $(DEPS)
- rm -f $(LIBS)
- rm -f $(BINS)
- rm -f $(UNTS)
+ @echo removing object files
+ @rm -f $(OBJS)
+ @echo removing dependency files
+ @rm -f $(DEPS)
+ @echo removing libraries
+ @rm -f $(LIBS)
+ @echo removing binaries
+ @rm -f $(BINS)
+ @echo removing unit tests
+ @rm -f $(UNTS)
install: targets
@echo installing executables
diff --git a/sys/cmd/dwm/rules.mk b/sys/cmd/dwm/rules.mk
index 680d741..a8ce4f5 100644
--- a/sys/cmd/dwm/rules.mk
+++ b/sys/cmd/dwm/rules.mk
@@ -20,9 +20,8 @@ $(BINS_$(d)): TCFLAGS = \
$(BINS_$(d)): TCLIBS = \
`$(PKG) --libs fontconfig` \
`$(PKG) --libs freetype2` \
- -lX11 -lXinerama -lXft -lX11-xcb -lxcb -lxcb-res \
- $(OBJ_DIR)/libn/libn.a
-$(BINS_$(d)): $(OBJS_$(d))
+ -lX11 -lXinerama -lXft -lX11-xcb -lxcb -lxcb-res
+$(BINS_$(d)): $(OBJS_$(d)) $(OBJ_DIR)/libn/libn.a
$(COMPLINK)
include share/pop.mk
diff --git a/sys/cmd/ic/.gitignore b/sys/cmd/ic/.gitignore
deleted file mode 100644
index 43d0692..0000000
--- a/sys/cmd/ic/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-ii
-*.a
-*.o
diff --git a/sys/cmd/ic/ic.c b/sys/cmd/ic/ic.c
index 50ce8c1..19b868d 100644
--- a/sys/cmd/ic/ic.c
+++ b/sys/cmd/ic/ic.c
@@ -14,9 +14,7 @@
#include <netdb.h>
#include <netinet/in.h>
-#ifdef NEED_STRLCPY
size_t strlcpy(char *, const char *, size_t);
-#endif
#define IRC_CHANNEL_MAX 200
#define IRC_MSG_MAX 512 /* guaranteed to be <= than PIPE_BUF */
diff --git a/sys/cmd/ic/rules.mk b/sys/cmd/ic/rules.mk
index 9a52e42..c373dfb 100644
--- a/sys/cmd/ic/rules.mk
+++ b/sys/cmd/ic/rules.mk
@@ -2,7 +2,7 @@ include share/push.mk
# Iterate through subdirectory tree
# Local sources
-SRCS_$(d) := $(d)/ic.c
+SRCS_$(d) := $(d)/strlcpy.c $(d)/ic.c
BINS_$(d) := $(d)/ic
include share/paths.mk
diff --git a/sys/libmath/rules.mk b/sys/libmath/rules.mk
index 9e44ce4..d3ff490 100644
--- a/sys/libmath/rules.mk
+++ b/sys/libmath/rules.mk
@@ -9,7 +9,6 @@ SRCS_$(d) := \
$(d)/blas2.c \
$(d)/blas3.c
LIBS_$(d) := $(d)/libmath.a
-BINS_$(d) :=
TSTS_$(d) := \
$(d)/blas.c \
$(d)/test.c
@@ -20,7 +19,7 @@ $(LIBS_$(d)): $(OBJS_$(d))
$(ARCHIVE)
$(UNTS_$(d)): TCFLAGS := -D_GNU_SOURCE
-$(UNTS_$(d)): TCLIBS := -lpthread -lm $(LIB_DIR)/vendor/libblas.a $(OBJ_DIR)/libn/libn.a $(LIBS_$(d))
+$(UNTS_$(d)): TCLIBS := -lpthread -lm $(LIB_DIR)/libblas.a $(OBJ_DIR)/libn/libn.a $(LIBS_$(d))
$(UNTS_$(d)): $(TOBJS_$(d)) $(LIBS_$(d)) $(OBJ_DIR)/libn/libn.a
$(LINK)