-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (50 loc) · 1.82 KB
/
Copy pathMakefile
File metadata and controls
65 lines (50 loc) · 1.82 KB
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
58
59
60
61
62
63
64
65
# Makefile for fsmount-syscalls examples
# Author: Generated makefile for building all examples
# Compiler and flags
CC = gcc
CFLAGS = -Wall -Wextra -O2 -g
LDFLAGS =
# Source files
SOURCES = example1-tmpfs.c \
example2-fspick.c \
example3-bind-mount.c \
example4-detached-mount-exec.c \
hello-world.c
# Object files (replace .c with .o)
OBJECTS = $(SOURCES:.c=.o)
# Executable names (remove .c extension)
EXECUTABLES = $(SOURCES:.c=)
# Default target
.PHONY: all clean help
all: $(EXECUTABLES)
# Rule to build executables from source files
# Each executable depends on its corresponding .c file and common.h
%: %.c common.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
# Individual targets for clarity
example1-tmpfs: example1-tmpfs.c common.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
example2-fspick: example2-fspick.c common.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
example3-bind-mount: example3-bind-mount.c common.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
example4-detached-mount-exec: example4-detached-mount-exec.c common.h
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
hello-world: hello-world.c
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
# Clean target
clean:
rm -f $(EXECUTABLES) $(OBJECTS) a.out
# Help target
help:
@echo "Available targets:"
@echo " all - Build all examples"
@echo " example1-tmpfs - Build tmpfs example"
@echo " example2-fspick - Build fspick example"
@echo " example3-bind-mount - Build bind mount example"
@echo " example4-detached-mount-exec - Build detached mount exec example"
@echo " hello-world - Build hello world example"
@echo " clean - Remove all built executables"
@echo " help - Show this help message"
# Declare phony targets
.PHONY: all clean help