-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.pc
61 lines (46 loc) · 1.46 KB
/
Makefile.pc
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
# Binary name
PROJECTNAME := libLog
# Libraries linked into the binary
LIBS := # Not currently used
# Directorys to include
INCLUDES := -Iinclude
# Additional compile flags
ERRORFLAGS := -Wall -Wextra -Wpedantic -Werror
OTHERFLAGS := -O0 -g -std=c99 -c -D_DEFAULT_SOURCE -D__LIBLOG_PC__
# -----------------------------------------------------------------------------
# Do not edit below this line unless you know what you are doing
# -----------------------------------------------------------------------------
ODIR := build
SDIR := src
CFLAGS := $(INCLUDES) $(ERRORFLAGS) $(OTHERFLAGS)
# Check for valgrind flag
ifeq ($(__VALGRIND__),true)
CFLAGS += -D__VALGRIND__
endif
LFLAGS := $(LIBS) # Not currently used
CFILES := $(wildcard $(SDIR)/*.c)
OBJS := $(patsubst $(SDIR)/%.c, $(ODIR)/%.o, $(CFILES))
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
CC := clang
LD := ld.lld # Not currently used
endif
ifeq ($(UNAME_S),Darwin)
CC := /usr/local/opt/llvm/bin/clang
LD := /usr/local/opt/llvm/bin/ld.lld # Not currently used
endif
# Make rules
$(PROJECTNAME): $(ODIR) $(OBJS)
$(CC) $(ODIR)/*.o -o $(PROJECTNAME)
@echo Built binary successfully!
$(ODIR)/%.o: $(SDIR)/%.c
$(CC) $(CFLAGS) -o $@ $<
$(ODIR):
@echo Creating build directory...
@mkdir $@
.PHONY: all clean
.DEFAULT_GOAL := all
all: $(PROJECTNAME)
clean:
@echo Cleaning up...
@rm -rf $(PROJECTNAME) $(ODIR)