-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
35 lines (25 loc) · 738 Bytes
/
makefile
File metadata and controls
35 lines (25 loc) · 738 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
30
31
32
33
34
35
CC = gcc
LD = gcc
PREFIX=/usr/bin
CFLAGS = -O3 -I./include -Wall -Wextra -pedantic -std=c2x -Werror -Wno-sign-compare
LDFLAGS =
SRCDIR := sources
BUILD_DIR := build
BOOTEFI := $(GNUEFI)/x86_64/bootloader/main.efi
OUT = $(BUILD_DIR)/fites
rwildcard=$(foreach d,$(wildcard $(1:=/*)),$(call rwildcard,$d,$2) $(filter $(subst *,%,$2),$d))
SRC = $(call rwildcard,$(SRCDIR),*.c)
OBJS = $(patsubst $(SRCDIR)/%.c, $(BUILD_DIR)/%.o, $(SRC))
DIRS = $(wildcard $(SRCDIR)/*)
build: $(OBJS) link
$(BUILD_DIR)/%.o: $(SRCDIR)/%.c
@ echo Compiling $^
@ mkdir -p $(@D)
$(CC) $(CFLAGS) -c $^ -o $@
link:
@ echo Linking...
$(LD) $(LDFLAGS) -o $(OUT) $(OBJS)
clean:
rm $(OBJS) $(OUT)
install: clean build
cp $(OUT) $(PREFIX)/fites