summaryrefslogtreecommitdiff
path: root/Makefile
blob: 6243fb3d95f21a30bb8b52541ef4496d2b9a5d0d (plain)
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
CC             = cc
# Release options
CFLAGS         = -Wall -Wextra -pedantic -O2 
TARGET         = build/crbc
# Debug options
DEBUG_CFLAGS   = -Wall -Wextra -pedantic -O0 -fsanitize=address,undefined -g
DEBUG_TARGET   = debug/crbc
# Source
SRC            = src/rbc.c
# Install targets
PREFIX        ?= /usr/local
BINDIR         = $(PREFIX)/bin
INSTALL_TARGET = crbc
INSTALL_DEBUG_TARGET = $(INSTALL_TARGET)_debug

# Compile all
All:
	$(CC) $(CFLAGS) $(SRC) -o $(TARGET)
	$(CC) $(DEBUG_CFLAGS) $(SRC) -o $(DEBUG_TARGET)

# Compile release (same as 'make')
Release:
	$(CC) $(CFLAGS) $(SRC) -o $(TARGET)

# Compile debug
Debug:
	$(CC) $(DEBUG_CFLAGS) $(SRC) -o $(DEBUG_TARGET)

# Clean all (release + debug)
cleanall:
	rm -f $(TARGET)
	rm -f $(DEBUG_TARGET)

# Clean release
CleanRelease:
	rm -f $(TARGET)

# Clean debug
CleanDebug:
	rm -f $(DEBUG_TARGET)

# Install all (release + debug)
Install:
	install -Dm755 $(INSTALL_TARGET) $(BINDIR)/crbc
	install -Dm755 $(INSTALL_DEBUG_TARGET) $(BINDIR)/crbc

# Install release
InstallRelease:
	install -Dm755 $(INSTALL_TARGET) $(BINDIR)/crbc

# Install debug
InstallDebug:
	install -Dm755 $(INSTALL_DEBUG_TARGET) $(BINDIR)/crbc

# Uninstall all
Uninstall:
	rm -f $(BINDIR)/$(INSTALL_TARGET)
	rm -f $(BINDIR)/$(INSTALL_DEBUG_TARGET)