-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
56 lines (43 loc) · 1.14 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
# Compiler
HIPCC = hipcc
# MidiFile library path
MIDIFILE_LIB = submodules/midifile/lib/libmidifile.a
# Flags
HIPFLAGS = -O2 -ffp-contract=off
INCLUDES = -Iinclude/ -I/usr/include -I/opt/rocm/include -Isubmodules/midifile/include
LIBS = -Lsubmodules/midifile/lib -l:libmidifile.a
# Source files
SRC = src/Main.cu
# Executable
EXE = build/Main
# Build everything
all: midiFile $(EXE)
# Build the main executable
$(EXE): $(SRC)
$(shell rm -f *.wav)
$(shell mkdir -p build)
$(HIPCC) $(HIPFLAGS) $(INCLUDES) $(INC) -o $(EXE) $(SRC) $(LIBS)
# Build the MidiFile library
midiFile:
@if [ ! -f $(MIDIFILE_LIB) ]; then \
echo "Building MidiFile library..."; \
cd submodules/midifile && make library -j8 && cd ../../; \
else \
echo "MidiFile library already built."; \
fi
# Clean up
clean:
rm -f $(EXE)
rm -rf build
$(MAKE) -C submodules/midifile clean
# Run the program
run: $(EXE)
./$(EXE)
# Help message
help:
@echo "Usage: make [all|clean|run|help]"
@echo " all: Build the executable"
@echo " clean: Remove the executable"
@echo " run: Run the executable"
@echo " help: Display this help message"
.PHONY: all clean run help midiFile