forked from zbanks/radiance
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
102 lines (84 loc) · 2.24 KB
/
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
PROJECT = radiance
#CC = gcc
#CC = clang
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Linux)
__LINUX__ = true
CFLAGS = -D__LINUX__
RADIANCE_LUX = true
RADIANCE_PP = true
endif
ifeq ($(UNAME_S),Darwin)
__APPLE__ = true
CFLAGS = -Wno-deprecated-declarations
RADIANCE_PP = true
endif
# Source files
C_SRC = main.c
C_SRC += $(wildcard audio/*.c)
C_SRC += $(wildcard midi/*.c)
# We'll add back the backends later below if appropriate
C_SRC += $(filter-out output/lux.c, $(filter-out output/pixel_pusher.c, $(wildcard output/*.c)))
C_SRC += $(wildcard pattern/*.c)
C_SRC += $(wildcard time/*.c)
C_SRC += $(wildcard ui/*.c)
# We'll add back util/opengl.c later below if appropriate
C_SRC += $(filter-out util/opengl.c, $(wildcard util/*.c))
C_SRC += $(wildcard BTrack/src/*.c)
ifdef __APPLE__
C_SRC += util/opengl.c
endif
ifdef RADIANCE_LUX
C_SRC += output/lux.c
C_SRC += liblux/lux.c liblux/crc.c
CFLAGS += -DRADIANCE_LUX
endif
ifdef RADIANCE_PP
C_SRC += output/pixel_pusher.c
CFLAGS += -DRADIANCE_PP
endif
OBJDIR = build
$(shell mkdir -p $(OBJDIR) >/dev/null)
OBJECTS = $(C_SRC:%.c=$(OBJDIR)/%.o)
# Compiler flags
INC = -I.
LIBRARIES = -lSDL2 -lSDL2_ttf -lm -lportaudio -lportmidi -lfftw3 -lsamplerate -lIL -lILU -lILUT
ifdef __LINUX__
LIBRARIES += -lGL -lGLU
else
LIBRARIES += -framework OpenGL
endif
CFLAGS += -std=c99 -ggdb3 -O3 $(INC)
CFLAGS += -Wall -Wextra -Werror -Wno-unused-parameter
CFLAGS += -D_POSIX_C_SOURCE=20160524
CFLAGS += -DILUT_USE_OPENGL
LFLAGS = $(CFLAGS)
# File dependency generation
DEPDIR = .deps
$(shell mkdir -p $(DEPDIR) >/dev/null)
DEPS = $(OBJECTS:$(OBJDIR)/%.o=$(DEPDIR)/%.d)
-include $(DEPS)
$(DEPDIR)/%.d : %.c .deps
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) $< -MM -MT $(@:$(DEPDIR)/%.d=%.o) >$@
# Targets
$(PROJECT): $(OBJECTS)
$(CC) $(LFLAGS) -o $(PROJECT) $(OBJECTS) $(LIBRARIES)
$(OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(APP_INC) -c -o $@ $<
# luxctl utility
luxctl: $(OBJDIR)/luxctl.o $(OBJDIR)/liblux/lux.o $(OBJDIR)/liblux/crc.o
$(CC) $(LFLAGS) -o $@ $^
ifdef RADIANCE_LUX
MAYBE_LUXCTL = luxctl
endif
.PHONY: all
all: $(PROJECT) $(MAYBE_LUXCTL)
.PHONY: clean
clean:
-rm -f $(PROJECT) tags $(MAYBE_LUXCTL)
-rm -rf $(OBJDIR) $(DEPDIR)
tags: $(C_SRC)
ctags --exclude='beat-off/*' -R .
.DEFAULT_GOAL := all