-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
29 lines (21 loc) · 841 Bytes
/
Copy pathMakefile
File metadata and controls
29 lines (21 loc) · 841 Bytes
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
outdir = out
srcdir = src
objdir = obj
compiler = clang
linker = clang
srcs = $(wildcard $(srcdir)/*.c)
objs = $(patsubst $(srcdir)/%,$(objdir)/%,$(srcs:.c=.o))
cflags = -std=gnu99 -O3 -pedantic -Iinclude -Iolutils/include -Wno-deprecated
ldflags = -s -lolutils -lcurl -larchive -ljson-c -Wall -Wextra -Wl,--gc-sections
all: olutils/x86_64/libolutils.a x86_64/$(outdir)/folder
olutils/x86_64/libolutils.a: olutils/olutils.c
make -C olutils
# Compile
x86_64/$(objdir)/%.o: $(srcdir)/%.c
$(compiler) -c $< -target x86_64-elf-linux $(cflags) -o $@
# Link
x86_64/$(outdir)/folder: $(patsubst $(objdir)/%,x86_64/$(objdir)/%,$(objs))
$(linker) $(patsubst $(objdir)/%,x86_64/$(objdir)/%,$(objs)) -target x86_64-elf-linux -Lolutils/x86_64 $(ldflags) -o $@
clean:
rm -f $(wildcard x86_64/obj/*.o) x86_64/out/folder
make -C olutils clean