-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (33 loc) · 900 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
36
37
38
39
40
41
42
43
44
45
# Makefile for WaveCraft
# Compiler and flags
CC = gcc
CFLAGS = -Wall -g
# Directories
SRCDIR = src
OBJDIR = obj
BINDIR = bin
# Source files and object files
SRCS := $(wildcard $(SRCDIR)/*.c)
OBJS := $(patsubst $(SRCDIR)/%.c,$(OBJDIR)/%.o,$(SRCS))
# Target executable
TARGET = wavecraft
# Libraries and their paths
LIBS = -lsndfile -lmp3lame -lasound -lm
# Default rule
all: directories $(TARGET)
# Rule to build the target executable
$(TARGET): $(OBJS)
$(CC) $(OBJS) $(LIBS) -o $(BINDIR)/$@
# Rule to compile source files into object files
$(OBJDIR)/%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -c $< -o $@
# Rule to create necessary directories
directories:
mkdir -p $(OBJDIR) $(BINDIR)
# Clean up generated files
clean:
rm -rf $(OBJDIR) $(BINDIR) $(TARGET)
# Very clean, including removing any generated output files
distclean: clean
rm -rf output/*
.PHONY: all clean distclean directories