Browse Source

Added BINARY macro and build target, remove dep from dependencies of

individual targets
tags/v0.6.1
Andrew Belt 6 years ago
parent
commit
00b972339d
3 changed files with 33 additions and 10 deletions
  1. +2
    -2
      CHANGELOG.md
  2. +12
    -8
      compile.mk
  3. +19
    -0
      include/util/common.hpp

+ 2
- 2
CHANGELOG.md View File

@@ -7,8 +7,8 @@
- Added velocity mode to MIDI-Trig
- Added MIDI multiplexing so multiple MIDI modules can use the same MIDI device on Windows
- Made Module Browser layout more compact
- Add power meter
- Add icons to toolbar
- Added power meter
- Added icons to toolbar
- [VCV Bridge](https://vcvrack.com/manual/Bridge.html) 0.6.1
- Replaced VST effect plugin with VST instrument plugin with audio inputs
- Added MIDI support


+ 12
- 8
compile.mk View File

@@ -8,6 +8,9 @@ endif

include $(RACK_DIR)/arch.mk

LD ?= ld
OBJCOPY ?= objcopy

FLAGS += -DVERSION=$(VERSION)
# Generate dependency files alongside the object files
FLAGS += -MMD -MP
@@ -44,6 +47,7 @@ CXXFLAGS += $(FLAGS)

# Derive object files from sources and place them before user-defined objects
OBJECTS := $(patsubst %, build/%.o, $(SOURCES)) $(OBJECTS)
OBJECTS += $(patsubst %, build/%.bin.o, $(BINARIES))
DEPENDENCIES := $(patsubst %, build/%.d, $(SOURCES))

# Final targets
@@ -53,23 +57,23 @@ $(TARGET): $(OBJECTS)

-include $(DEPENDENCIES)

build/%.c.o: %.c | dep
build/%.c.o: %.c
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<

build/%.cpp.o: %.cpp | dep
build/%.cpp.o: %.cpp
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<

build/%.cc.o: %.cc | dep
build/%.cc.o: %.cc
@mkdir -p $(@D)
$(CXX) $(CXXFLAGS) -c -o $@ $<

build/%.m.o: %.m | dep
build/%.m.o: %.m
@mkdir -p $(@D)
$(CC) $(CFLAGS) -c -o $@ $<

# Dummy target
dep:
.PHONY: dep
build/%.bin.o: %
@mkdir -p $(@D)
$(LD) -r -b binary -o $@ $<
$(OBJCOPY) --rename-section .data=.rodata,alloc,load,readonly,data,contents $@ $@

+ 19
- 0
include/util/common.hpp View File

@@ -55,6 +55,25 @@ Example:
#define DEPRECATED __attribute__ ((deprecated))


/** References binary files compiled into the program.
For example, to include a file "Test.dat" directly into your program binary, add
BINARIES += Test.dat
to your Makefile and declare
BINARY(Test_dat);
at the root of a .c or .cpp source file. Note that special characters are replaced with "_". Then use
BINARY_START(Test_dat)
BINARY_END(Test_dat)
to reference the data beginning and end as a void* array and
BINARY_SIZE(Test_dat)
to get its size in bytes.
*/
#define BINARY(sym) extern char _binary_##sym##_start, _binary_##sym##_end, _binary_##sym##_size
#define BINARY_START(sym) ((void *) &_binary_##sym##_start)
#define BINARY_END(sym) ((void *) &_binary_##sym##_end)
// The symbol "_binary_##sym##_size" doesn't seem to be valid after a plugin is dynamically loaded, so simply take the difference between the two addresses.
#define BINARY_SIZE(sym) ((size_t) (&_binary_##sym##_end - &_binary_##sym##_start))


#include "util/math.hpp"




Loading…
Cancel
Save