aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <tslil@posteo.de>2021-01-29 13:06:49 -0500
committertslil <tslil@posteo.de>2026-08-28 19:37:41 +0100
commit6c1154d80e7f7a04444d01d97942ac9e8138297a (patch)
treefbd85a108793aa4ac4fa6dc618d201da55df64b1
parenta5cb8973496611b82d3e4caa3c95f6e6ba1367be (diff)
Cleaned up build system
-rw-r--r--Makefile35
-rw-r--r--README.md4
-rwxr-xr-xresources/do_buildroot.sh (renamed from do_buildroot.sh)5
-rwxr-xr-xresources/extract.sh (renamed from extract.sh)0
4 files changed, 24 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index c488aa7..d2b5ce8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,19 +1,20 @@
+STRIP=strip
+
IDIR=include
DEFINES=-DDETERMINISTIC
CFLAGS=-O3 -Wall -Wextra -Wpedantic -std=c99 -D_DEFAULT_SOURCE $(DEFINES) -I$(IDIR) -lm
LIBS=
+CTAK=include/tak.c
+CTAK_OBJS=$(CTAK:.c=.o)
SRCS=$(wildcard include/*.c)
OBJS=$(SRCS:.c=.o)
BUILDROOT_DIR=buildroot-2020.11.1
+CROSS_CC=$(BUILDROOT_DIR)/output/host/bin/arm-linux-cc
+CROSS_STRIP=$(BUILDROOT_DIR)/output/host/bin/arm-linux-strip
-ifeq ($(PLATFORM), native)
- STRIP=strip
-else
- STRIP=$(BUILDROOT_DIR)/output/host/bin/arm-linux-strip
- CC=$(BUILDROOT_DIR)/output/host/bin/arm-linux-cc
-endif
+.DEFAULT_GOAL=native
%.o: %.c
$(CC) -c $< -o $@ $(CFLAGS)
@@ -22,19 +23,25 @@ ctaklm: src/ctaklm.o $(OBJS)
$(CC) $(CFLAGS) src/ctaklm.o $(OBJS) -o ctaklm
$(STRIP) ctaklm
-pptdb: src/pptdb.o $(OBJS)
- $(CC) $(CFLAGS) src/pptdb.o $(OBJS) -o pptdb
-
ct1986: src/ct1986.o $(OBJS)
$(CC) $(CFLAGS) src/ct1986.o $(OBJS) -o ct1986
$(STRIP) ct1986
-all: ctaklm ct1986
-ifneq ($(PLATFORM), native)
- $(info Building the pi image)
- ./do_buildroot.sh $(BUILDROOT_DIR)
-endif
+pptdb: src/pptdb.o $(CTAK_OBJS)
+ $(CC) $(CFLAGS) src/pptdb.o $(CTAK_OBJS) -o pptdb
clean:
rm -f ctaklm ct1986 pptdb
rm -f src/*.o include/*.o
+
+native: clean ctaklm pptdb
+
+$(CROSS_CC):
+ ./resources/do_buildroot.sh $(BUILDROOT_DIR)
+
+pi: CC=$(CROSS_CC)
+pi: STRIP=$(CROSS_STRIP)
+pi: $(CROSS_CC) clean ctaklm ct1986
+ cp ct1986 ctaklm $(BUILDROOT_DIR)/board/raspberrypi0/rootfs_overlay/
+ make -C $(BUILDROOT_DIR)
+ $(info Image ready in $(BUILDROOT_DIR)/output/images/sdcard.img)
diff --git a/README.md b/README.md
index 0acbb9a..ea0e172 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ Details forthcoming, but at a glance:
## Building for the native platform
- PLATFORM=native make ctaklm
+ make native
## Building for the Raspberry Pi Zero
@@ -20,7 +20,7 @@ Download and extract a recent version of buildroot into the working
directory. Edit `BUILDROOT_DIR=buildroot-2020.11.1` in `Makefile` to
point to the extracted directory.
- make all
+ make pi
## The computer opponent
diff --git a/do_buildroot.sh b/resources/do_buildroot.sh
index ee2e1d9..2df2e76 100755
--- a/do_buildroot.sh
+++ b/resources/do_buildroot.sh
@@ -23,7 +23,7 @@ overlay="$board/rootfs_overlay/"
# Build configuration
cp resources/buildroot.config "$BR/.config"
cp resources/linux.config resources/busybox.config "$board" # Causes recompile
-cp resources/{post-build,ct1986}.sh resources/genimage-raspberrypi0.cfg "$board"
+cp resources/post-build.sh resources/ct1986.sh resources/genimage-raspberrypi0.cfg "$board"
# Overlay filesystem
dirs="/usr/bin"
@@ -33,7 +33,4 @@ for dir in $dirs; do
fi
done
-cp ctaklm ct1986 "$overlay/usr/bin"
-cp resources/ash-profile "$overlay/.profile"
-
cd "$BR" && make
diff --git a/extract.sh b/resources/extract.sh
index fb6f267..fb6f267 100755
--- a/extract.sh
+++ b/resources/extract.sh