ms-runner/Makefile

44 lines
2.2 KiB
Makefile

.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)
$(GEN):
mkdir -p $(GEN)
$(GEN)/google/protobuf/empty.pb-c.c $(GEN)/google/protobuf/empty.pb-c.h: $(PROTOBUF)/google/protobuf/empty.proto $(GEN)
protoc --c_out=$(GEN) google/protobuf/empty.proto -I $(PROTOBUF)
$(GEN)/google/protobuf/timestamp.pb-c.c $(GEN)/google/protobuf/timestamp.pb-c.h: $(PROTOBUF)/google/protobuf/timestamp.proto $(GEN)
protoc --c_out=$(GEN) google/protobuf/timestamp.proto -I $(PROTOBUF)
$(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)
protoc --c_out=$(GEN) runner/v1/runner.proto -I proto
$(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) -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
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
$(RUNS):
mkdir $(RUNS)
include tests/Makefile