-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
57 lines (45 loc) · 1.07 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
-include .env
export
CC = gcc
CFLAGS ?= -Wall -Os
LDFLAGS += $(shell pkg-config --libs-only-L libprocps)
LDLIBS += $(shell pkg-config --libs-only-l libprocps)
.PHONY: build
build: minit sample
.PHONY: run
run: minit sample
$(info running $<...)
@exec ./minit ./sample 3
.PHONY: test
test:
@docker build --load --target test \
--build-arg PROCPS_VERSION=3.3.17 \
-t minit:test .
.PHONY: image-test
image-test:
@docker build --load \
--build-arg PROCPS_VERSION=3.3.17 \
-t minit:latest .
@container-structure-test test -c structure-test.yaml -i minit:latest
.PHONY: clean
clean:
@${RM} minit
@${RM} sample
minit: minit.c
$(info building $@...)
@$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
sample: sample.c
$(info building $@...)
@$(CC) $(CFLAGS) -o $@ $^
.PHONY: kill
kill: kill-sample kill-minit
.PHONY: kill-%
kill-%:
@pidof $* | ifne xargs kill -INT
.PHONY: pids
pids:
@ps -o pgid,ppid,pid,comm,args | awk '$$4 == "minit" || $$4 == "sample" || $$4 == "sleep"'
image:
@docker build --load \
--build-arg PROCPS_VERSION=${PROCPS_VERSION} \
-t minit:latest .