4klang, Clinkster, Oidos and V2 on Linux template code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

81 lines
2.2 KiB

# C++ version is more stable, but might be larger
USE_CXX_VERSION ?= 1
# you most likely want this
USE_RONAN ?= 1
NASM ?= nasm
default: all
%/:
mkdir -p "$@"
v2m-player/README.md:
@>&2 echo "\`v2m-player' submodule not initialized. Please run the following command:"
@>&2 echo " git submodule update --init --recursive"
@false
fr_public/README.md:
@>&2 echo "\`fr_public' submodule not initialized. Please run the following command:"
@>&2 echo " git submodule update --init --recursive"
@false
CFLAGS := -m32
ASFLAGS := -felf32
ifeq ($(USE_CXX_VERSION),0)
CFLAGS += -I libv2/
else
CFLAGS += -I v2m-player/src/ -DUSE_CXX_VERSION
endif
ifneq ($(USE_RONAN),0)
CFLAGS += -DRONAN
ASFLAGS += -DRONAN
endif
CFLAGS += -g -ffunction-sections -fdata-sections
ASFLAGS += -g
obj/lplayer.o: src/lplayer.cpp obj/
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/v2mplayer.o: libv2/v2mplayer.cpp obj/ fr_public/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/synth.o: libv2/synth.asm obj/ fr_public/README.md
$(NASM) $(ASFLAGS) -o "$@" "$<"
obj/pv2mconv.o: v2m-player/src/v2mconv.cpp obj/ v2m-player/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/pv2mplayer.o: v2m-player/src/v2mplayer.cpp obj/ v2m-player/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/pronan.o: v2m-player/src/ronan.cpp obj/ v2m-player/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/psynth_core.o: v2m-player/src/synth_core.cpp obj/ v2m-player/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/psounddef.o: v2m-player/src/sounddef.cpp obj/ v2m-player/README.md
$(CXX) $(CFLAGS) -o "$@" -c "$<"
obj/v2m-%.asm: mus/%.v2m obj/
printf "[section .data.theTune]\n" > "$@"
printf "global theTune\ntheTune:\n\tincbin \"%s\"\n" "$<" >> "$@"
printf "global theTune_size\ntheTune_size:\n\tdd \$$ - theTune\n" >> "$@"
obj/v2m-%.o: obj/v2m-%.asm
$(NASM) -g -f elf32 -o "$@" "$<"
ifeq ($(USE_CXX_VERSION),0)
bin/lplayer-%: obj/lplayer.o obj/synth.o obj/v2mplayer.o obj/v2m-%.o bin/
else
bin/lplayer-%: obj/lplayer.o obj/psynth_core.o obj/pv2mconv.o obj/pv2mplayer.o \
obj/pronan.o obj/psounddef.o obj/v2m-%.o bin/
endif
$(CXX) -Wl,--gc-sections $(CFLAGS) -o "$@" $(filter-out bin/,$^)
all: $(patsubst mus/%.v2m,bin/lplayer-%,$(wildcard mus/*.v2m))
echo $^
clean:
$(RM) -vr obj/ bin/
.PHONY: all clean default