This commit is contained in:
dragonmuffin dragonmuffin 2025-05-05 14:44:26 +05:00
parent 7510c2a7b3
commit 73b2f7f3b5
10 changed files with 67 additions and 35 deletions

View file

@ -1,13 +1,11 @@
.PHONY: all clean install uninstall test
PROTOBUF=/usr/include/
STARTER=starter
GEN=gen
SRCS=$(STARTER)/cgroup_prepare.c $(STARTER)/ns_exec.c $(STARTER)/util.c $(STARTER)/starter.c
RUNS=runs
PROTO_OUT=$(GEN)/google/protobuf/empty.pb-c.c $(GEN)/google/protobuf/empty.pb-c.h $(GEN)/google/protobuf/timestamp.pb-c.c $(GEN)/google/protobuf/timestamp.pb-c.h $(GEN)/google/protobuf/duration.pb-c.c $(GEN)/google/protobuf/duration.pb-c.h gen/runner/v1/runner.pb-c.c gen/runner/v1/runner.pb-c.c
all: $(STARTER)/alpine-make-rootfs $(STARTER)/minrootfs $(STARTER)/starter transport/transport $(RUNS)
all: starter/alpine-make-rootfs starter/minrootfs starter/starter.so transport/transport $(RUNS) $(GEN)/google/protobuf/empty.pb-c.c $(GEN)/google/protobuf/empty.pb-c.h $(GEN)/google/protobuf/timestamp.pb-c.c $(GEN)/google/protobuf/timestamp.pb-c.h $(GEN)/google/protobuf/duration.pb-c.c $(GEN)/google/protobuf/duration.pb-c.h $(GEN)/runner/v1/runner.pb-c.c $(GEN)/runner/v1/runner.pb-c.h
$(GEN):
mkdir -p $(GEN)
@ -21,23 +19,21 @@ $(GEN)/google/protobuf/timestamp.pb-c.c $(GEN)/google/protobuf/timestamp.pb-c.h:
$(GEN)/google/protobuf/duration.pb-c.c $(GEN)/google/protobuf/duration.pb-c.h: $(PROTOBUF)/google/protobuf/duration.proto $(GEN)
protoc --c_out=$(GEN) google/protobuf/duration.proto -I $(PROTOBUF)
gen/runner/v1/runner.pb-c.c gen/runner/v1/runner.pb-c.h: proto/runner/v1/runner.proto $(GEN)
$(GEN)/runner/v1/runner.pb-c.c $(GEN)/runner/v1/runner.pb-c.h: proto/runner/v1/runner.proto $(GEN)
protoc --c_out=$(GEN) runner/v1/runner.proto -I proto
$(STARTER)/alpine-make-rootfs:
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/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) -shared -o $(STARTER)/starter $(SRCS) -g -fsanitize=address -fsanitize=leak -fno-omit-frame-pointer -lrabbitmq -lprotobuf-c -I gen
$(CC) -fPIC -shared -o $(STARTER)/starter $(SRCS) -lrabbitmq -lprotobuf-c -I gen
#$(CC) $(STARTER)/starter.c -o $(STARTER)/starter
starter/starter.so: $(PROTO) starter/starter.c starter/cgroup_prepare.c starter/ns_exec.c starter/util.c
$(CC) -fPIC -shared -o starter/starter.so $^ -lrabbitmq -lprotobuf-c -I gen
transport/transport: $(PROTO) transport/utils.c transport/transport.c transport/transport.h
$(CC) -o $@ gen/runner/v1/runner.pb-c.c transport/utils.c transport/transport.c -I . -I gen -lrabbitmq -lprotobuf-c -g -fsanitize=address -fsanitize=leak -fno-omit-frame-pointer
transport/transport: $(PROTO) transport/utils.c transport/transport.c transport/transport.h starter/starter.so
$(CC) -o $@ gen/runner/v1/runner.pb-c.c transport/utils.c transport/transport.c starter/starter.so -I . -I starter -I gen -lrabbitmq -lprotobuf-c -lcurl -fsanitize=address -g
$(RUNS):
mkdir $(RUNS)