remove go part; prettify c code

This commit is contained in:
dragonmuffin 2025-01-07 21:56:21 +05:00
parent 1fa11f66e3
commit ebc4311c86
21 changed files with 86 additions and 742 deletions

View file

@ -1,19 +1,19 @@
all:
make init
make mkrootfs
make compile
make generate
init:
git clone https://github.com/alpinelinux/alpine-make-rootfs
rm -rf starter/minrootfs
mv alpine-make-rootfs starter/alpine-make-rootfs
mkrootfs:
starter/create_rootfs.sh
gen:
buf generate
compile:
go build -o ./run
gcc starter/starter.c -o starter/starter
dev:
@make gen
@go run main.go
.PHONY: all clean install uninstall
PROTOBUF=/usr/include/
STARTER=starter
GEN=gen
SRCS=$(STARTER)/cgroup_prepare.c $(STARTER)/ns_exec.c $(STARTER)/util.c $(STARTER)/starter.c
all: proto $(STARTER)/alpine-make-rootfs $(STARTER)/minrootfs $(STARTER)/starter
proto: /usr/include/google/protobuf/empty.proto proto/runner/v1/runner.proto
mkdir -p $(GEN)
protoc --c_out=$(GEN) runner/v1/runner.proto -I proto
protoc --c_out=$(GEN) google/protobuf/empty.proto -I $(PROTOBUF)
$(STARTER)/alpine-make-rootfs:
git clone https://github.com/alpinelinux/alpine-make-rootfs starter/alpine-make-rootfs
$(STARTER)/minrootfs: $(STARTER)/create_rootfs.sh
$(STARTER)/create_rootfs.sh
$(STARTER)/starter: proto $(STARTER)/starter.c $(STARTER)/cgroup_prepare.c $(STARTER)/ns_exec.c Makefile
$(CC) -o $(STARTER)/starter $(SRCS) -g -fsanitize=address -fsanitize=leak -fno-omit-frame-pointer -lrabbitmq -lprotobuf-c -I gen
#$(CC) $(STARTER)/starter.c -o $(STARTER)/starter