A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita
audio
rust
zig
deno
mpris
rockbox
mpd
1# __________ __ ___.
2# Open \______ \ ____ ____ | | _\_ |__ _______ ___
3# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
4# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
5# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
6# \/ \/ \/ \/ \/
7# $Id$
8#
9
10SDL_SRCDIR := $(APPSDIR)/plugins/sdl
11SDL_OBJDIR := $(BUILDDIR)/apps/plugins/sdl
12
13SDL_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES)
14DUKE3D_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES.duke)
15WOLF3D_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES.wolf)
16QUAKE_SRC := $(call preprocess, $(SDL_SRCDIR)/SOURCES.quake)
17
18SDL_OBJ := $(call c2obj, $(SDL_SRC))
19DUKE3D_OBJ = $(call c2obj, $(DUKE3D_SRC))
20WOLF3D_OBJ = $(call c2obj, $(WOLF3D_SRC))
21QUAKE_OBJ = $(call c2obj, $(QUAKE_SRC))
22
23# add source files to OTHER_SRC to get automatic dependencies
24OTHER_SRC += $(SDL_SRC) $(DUKE3D_SRC) $(WOLF3D_SRC) $(QUAKE_SRC)
25OTHER_INC += -I$(SDL_SRCDIR)/include
26
27# include comes first because of possible system SDL headers taking
28# precedence
29# some of these are for Quake only
30SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
31-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wcast-align \
32-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
33-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF -w # disable all warnings
34
35# WIP SDLFLAGS for warning deletions
36#SDLFLAGS = -I$(SDL_SRCDIR)/include $(filter-out -O%,$(PLUGINFLAGS)) \
37#-O3 -Wno-unused-parameter -Xpreprocessor -Wno-undef -Wno-sign-compare \
38#-Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-unknown-pragmas \
39#-ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations \
40#-D_GNU_SOURCE=1 -D_REENTRANT -DSDL -DELF
41
42ifndef APP_TYPE
43 ### no target has a big enough plugin buffer
44 ROCKS += $(SDL_OBJDIR)/duke3d.ovl
45 ROCKS += $(SDL_OBJDIR)/wolf3d.ovl
46 ROCKS += $(SDL_OBJDIR)/quake.ovl
47
48 DUKE3D_OUTLDS = $(SDL_OBJDIR)/duke3d.link
49 WOLF3D_OUTLDS = $(SDL_OBJDIR)/wolf3d.link
50 QUAKE_OUTLDS = $(SDL_OBJDIR)/quake.link
51
52 SDL_OVLFLAGS = -Wl,--gc-sections -Wl,-Map,$(basename $@).map $(GLOBAL_LDOPTS)
53else
54 ### simulator
55 ROCKS += $(SDL_OBJDIR)/duke3d.rock
56 ROCKS += $(SDL_OBJDIR)/wolf3d.rock
57 ROCKS += $(SDL_OBJDIR)/quake.rock
58endif
59
60# Duke3D
61
62$(SDL_OBJDIR)/duke3d.rock: $(SDL_OBJ) $(DUKE3D_OBJ) $(TLSFLIB)
63
64$(SDL_OBJDIR)/duke3d.refmap: $(SDL_OBJ) $(DUKE3D_OBJ) $(TLSFLIB)
65
66$(DUKE3D_OUTLDS): $(PLUGIN_LDS) $(SDL_OBJDIR)/duke3d.refmap
67 $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
68 $(TOOLSDIR)/ovl_offset.pl $(SDL_OBJDIR)/duke3d.refmap))
69
70$(SDL_OBJDIR)/duke3d.ovl: $(SDL_OBJ) $(DUKE3D_OBJ) $(TLSFLIB) $(DUKE3D_OUTLDS)
71 $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
72 $(filter %.o, $^) \
73 $(filter %.a, $+) \
74 -lgcc -T$(DUKE3D_OUTLDS) $(SDL_OVLFLAGS)
75 $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
76
77# Wolf3D
78
79$(SDL_OBJDIR)/wolf3d.rock: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB)
80
81$(SDL_OBJDIR)/wolf3d.refmap: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB)
82
83$(WOLF3D_OUTLDS): $(PLUGIN_LDS) $(SDL_OBJDIR)/wolf3d.refmap
84 $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
85 $(TOOLSDIR)/ovl_offset.pl $(SDL_OBJDIR)/wolf3d.refmap))
86
87$(SDL_OBJDIR)/wolf3d.ovl: $(SDL_OBJ) $(WOLF3D_OBJ) $(TLSFLIB) $(WOLF3D_OUTLDS)
88 $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
89 $(filter %.o, $^) \
90 $(filter %.a, $+) \
91 -lgcc -T$(WOLF3D_OUTLDS) $(SDL_OVLFLAGS)
92 $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
93
94# Quake
95###
96
97$(SDL_OBJDIR)/quake.rock: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB)
98
99$(SDL_OBJDIR)/quake.refmap: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB)
100
101$(QUAKE_OUTLDS): $(PLUGIN_LDS) $(SDL_OBJDIR)/quake.refmap
102 $(call PRINTS,PP $(@F))$(call preprocess2file,$<,$@,-DOVERLAY_OFFSET=$(shell \
103 $(TOOLSDIR)/ovl_offset.pl $(SDL_OBJDIR)/quake.refmap))
104
105$(SDL_OBJDIR)/quake.ovl: $(SDL_OBJ) $(QUAKE_OBJ) $(TLSFLIB) $(QUAKE_OUTLDS)
106 $(SILENT)$(CC) $(PLUGINFLAGS) -o $(basename $@).elf \
107 $(filter %.o, $^) \
108 $(filter %.a, $+) \
109 -lgcc -T$(QUAKE_OUTLDS) $(SDL_OVLFLAGS)
110 $(call PRINTS,LD $(@F))$(call objcopy,$(basename $@).elf,$@)
111
112###
113
114# common
115
116$(SDL_OBJDIR)/%.o: $(SDL_SRCDIR)/%.c $(SDL_SRCDIR)/sdl.make $(BUILDDIR)/sysfont.h
117 $(SILENT)mkdir -p $(dir $@)
118 $(call PRINTS,CC $(call full_path_subst,$(ROOTDIR)/%,%,$<))$(CC) -I$(dir $<) $(SDLFLAGS) -c $< -o $@
119 $(SILENT)$(OC) --redefine-syms=$(SDL_SRCDIR)/redefines.txt $@