-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
35 lines (24 loc) · 855 Bytes
/
Makefile
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 = clang
CFLAGS = -std=c99 -Wall -Wextra -pedantic
LDFLAGS = -lm -lncurses -lportaudio -lportmidi -lev
BUILD_DIR = build
SRC_DIR = src
TARGET = astrovox
DEBUG_TARGET = astrovox_debug
SRCS = $(wildcard $(SRC_DIR)/*.c)
OBJS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SRCS))
DEBUG_OBJS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/debug/%.o,$(SRCS))
.PHONY: all debug clean
all: $(BUILD_DIR)/$(TARGET)
debug: CFLAGS += -g
debug: $(BUILD_DIR)/$(DEBUG_TARGET)
$(BUILD_DIR)/$(TARGET): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS)
$(BUILD_DIR)/$(DEBUG_TARGET): $(DEBUG_OBJS)
$(CC) $(CFLAGS) $(DEBUG_OBJS) -o $@ $(LDFLAGS)
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
$(BUILD_DIR)/debug/%.o: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -g -c $< -o $@
clean:
rm -f $(OBJS) $(DEBUG_OBJS) $(BUILD_DIR)/$(TARGET) $(BUILD_DIR)/$(DEBUG_TARGET)