-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
54 lines (37 loc) · 865 Bytes
/
makefile
File metadata and controls
54 lines (37 loc) · 865 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
CC ?=
ifndef $(CC)
CC := gcc
endif
BINARY ?=
ifndef BINARY
BINARY := Operating_Systems_II_Assignment1
endif
# This flag is enabled so that we can pass the -DTEST_THIS_CODE flag
MACROS_FLAGS ?=
MACROS_FLAGS := $(MACROS_FLAGS)
IFLAGS ?=
IFLAGS := -I./
FLAGS ?=
FLAGS := -std=gnu99 $(FLAGS) $(IFLAGS) $(MACROS_FLAGS) $(WGWFLAGS)
LDFLAGS ?=
LDFLAGS := -lncurses $(LDFLAGS) $(WGWLDFLAGS)
SOURCES ?= $(shell find . -name "*.c")
OBJECTS := $(SOURCES:%.c=%.o)
.PHONY: all clean run help
all: $(BINARY)
@echo "Compilation complete"
%.o: %.c
@echo "COMPILING: $<"
@$(CC) -o $@ -c $< $(FLAGS)
$(BINARY): $(OBJECTS)
@echo "LINKING: $^"
$(CC) -o $@ $^ $(FLAGS) $(LDFLAGS)
run: $(BINARY)
@echo "RUNNING: $<"
./$<
clean:
@rm -fr $(OBJECTS) $(BINARY)
@echo "DELETED: $(OBJECTS) $(BINARY)"
help:
@echo "`make` to compile"
@echo flags are clean run