uwu man
sophuwu sophie@skisiel.com
Sun, 23 Jun 2024 16:00:12 +0200
9 files changed,
39 insertions(+),
10 deletions(-)
M
Makefile
→
Makefile
@@ -1,14 +1,12 @@
NAME := termcalc - -CXX := g++ -std=c++17 -SRC := src/*.cpp -TARGET := $(NAME) +CCFLAGS := -O3 +SRC := src/*.c -all: $(TARGET) +all: $(SRC) + @./zig-cc/zigcomp -$(TARGET): $(SRC) - $(CXX) -o $(TARGET) $(SRC) +zig: $(SRC) + $(CC) $(CCFLAGS) -o build/$(NAME).$(ZIGTARGET) $(SRC) clean: - rm $(TARGET) - + @echo "clean target is for compatibility with autotools"
M
src/calc.c
→
src/calc.c
@@ -3,7 +3,6 @@ // This program is a simple calculator that takes in two numbers and an operator and returns the result of the operation.
#include "calc.h" - int checkInput(int argc) { if (argc != 4) print ("Usage: calc <num1> <op> <num2>\n\n\tOperators: + - x / %\n\tExample: calc 10 / 5\n"); return argc != 4;
A
zig-cc/zigcomp
@@ -0,0 +1,20 @@
+#!/bin/bash +declare -a ZIGTARGETS=( + 'x86_64-linux-musl' + 'aarch64-linux-musl' +) +#arm-linux-musleabihf ## 32 bit arm +ZIGBIN="$PWD/zig-cc" +export CC="$ZIGBIN/cc" +export CXX="$ZIGBIN/cxx" +export AR="$ZIGBIN/ar" +export LD="$ZIGBIN/ld" +export RANLIB="$ZIGBIN/ranlib" + +for Target in "${ZIGTARGETS[@]}"; +do + export ZIGTARGET=$Target + echo "============ $ZIGTARGET ============" + make zig +done +