-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
64 lines (46 loc) · 2.14 KB
/
Makefile
File metadata and controls
64 lines (46 loc) · 2.14 KB
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
# The source klystrack song file
SONGFILE ?= song.kt
# The resulting binary will be written to these two files
EXECFILE ?= bin/song.exe
COMPRESSEDEXEC ?= bin/song_compressed.exe
# klystron PROFILE should be "size" for size optimized binary but you can change it here
PROFILE = size
EXTFLAGS = -nostdlib -s -DUSESDLMUTEXES -DSTEREOOUTPUT -DUSENATIVEAPIS
# Uncomment the below line to enable the WAV writer
EXTFLAGS += -DENABLE_WAV_WRITER=1
# Here are the feature flags you can use to disable unused features to minimize the size.
# Make the wavetable use lower resolution
#EXTFLAGS += -DLOWRESWAVETABLE
# Disable almost everything
#EXTFLAGS += -DCYD_DISABLE_WAVETABLE -DCYD_DISABLE_FX -DCYD_DISABLE_LFSR \
-DCYD_DISABLE_MULTIPLEX -DCYD_DISABLE_BUZZ -DCYD_DISABLE_FILTER \
-DCYD_DISABLE_VIBRATO -DCYD_DISABLE_PWM -DCYD_DISABLE_ENVELOPE \
-DCYD_DISABLE_INACCURACY
# You need kkrunchy for the compressed binary (http://www.farbrausch.de/~fg/kkrunchy/)
# If it's not available, the step will be skipped and the song will not be compressed
KKRUNCHY := kkrunchy_k7.exe -best
MAKE := make -j4
LIBS := -lwinmm -lmsvcrt -lgcc -lkernel32 -luser32
EXTFLAGS += $(LIBS)
all: $(EXECFILE) $(COMPRESSEDEXEC)
@echo "Song binary compiled from '$(SONGFILE)'"
@echo " - Binary written to '$(EXECFILE)' ($(shell ls $(EXECFILE) -l | awk '{print $$5}') bytes)"
@echo " - Compressed binary written to '$(COMPRESSEDEXEC)' ($(shell ls $(COMPRESSEDEXEC) -l | awk '{print $$5}') bytes)"
$(COMPRESSEDEXEC): $(EXECFILE)
@cp $(EXECFILE) $(COMPRESSEDEXEC)
@$(KKRUNCHY) $(COMPRESSEDEXEC)
$(EXECFILE): src/player.c temp/data.inc
@mkdir -p bin
@$(MAKE) -C ./klystron ksnd CFG=$(PROFILE) EXTFLAGS="$(EXTFLAGS)"
@gcc -Os $(EXTFLAGS) -o $(EXECFILE) src/player.c -lksndstatic -Wall $(LIBS) -I ./klystron/src/lib -L ./klystron/bin.$(PROFILE)
temp/data.inc: temp/bin2c.exe $(SONGFILE)
@mkdir -p temp
@echo "static unsigned char data[] = {" > temp/data.inc
@temp/bin2c.exe $(SONGFILE) >> temp/data.inc
@echo "};" >> temp/data.inc
clean:
@$(MAKE) -C ./klystron clean
@rm -rf bin temp $(COMPRESSEDEXEC) $(EXECFILE)
temp/bin2c.exe: src/bin2c.c
@mkdir -p temp
@gcc -Wall src/bin2c.c -o temp/bin2c.exe