diff --git a/src/binaryToObject/tools.h b/include/avian/tools/object-writer/tools.h similarity index 100% rename from src/binaryToObject/tools.h rename to include/avian/tools/object-writer/tools.h diff --git a/makefile b/makefile index 1e29f0ca91..38872186bf 100755 --- a/makefile +++ b/makefile @@ -214,7 +214,7 @@ warnings = -Wall -Wextra -Werror -Wunused-parameter -Winit-self \ target-cflags = -DTARGET_BYTES_PER_WORD=$(pointer-size) common-cflags = $(warnings) -fno-rtti -fno-exceptions -I$(classpath-src) \ - "-I$(JAVA_HOME)/include" -idirafter $(src) -I$(build) $(classpath-cflags) \ + "-I$(JAVA_HOME)/include" -idirafter $(src) -I$(build) -Iinclude $(classpath-cflags) \ -D__STDC_LIMIT_MACROS -D_JNI_IMPLEMENTATION_ -DAVIAN_VERSION=\"$(version)\" \ -DAVIAN_INFO="\"$(info)\"" \ -DUSE_ATOMIC_OPERATIONS -DAVIAN_JAVA_HOME=\"$(javahome)\" \ @@ -232,7 +232,7 @@ endif build-cflags = $(common-cflags) -fPIC -fvisibility=hidden \ "-I$(JAVA_HOME)/include/linux" -I$(src) -pthread -converter-cflags = -D__STDC_CONSTANT_MACROS -Isrc/binaryToObject -Isrc/ \ +converter-cflags = -D__STDC_CONSTANT_MACROS -Iinclude/ -Isrc/ \ -fno-rtti -fno-exceptions \ -DAVIAN_TARGET_ARCH=AVIAN_ARCH_UNKNOWN \ -DAVIAN_TARGET_FORMAT=AVIAN_FORMAT_UNKNOWN \ @@ -1126,18 +1126,20 @@ generator-lzma-objects = \ $(call generator-c-objects,$(lzma-decode-sources),$(lzma)/C,$(build)) generator = $(build)/generator -converter-depends = \ - $(src)/binaryToObject/tools.h \ - $(src)/binaryToObject/endianness.h +all-depends = $(shell find include -name '*.h') -converter-sources = \ - $(src)/binaryToObject/tools.cpp \ - $(src)/binaryToObject/elf.cpp \ - $(src)/binaryToObject/mach-o.cpp \ - $(src)/binaryToObject/pe.cpp +object-writer-depends = $(shell find $(src)/tools/object-writer -name '*.h') +object-writer-sources = $(shell find $(src)/tools/object-writer -name '*.cpp') +object-writer-objects = $(call cpp-objects,$(object-writer-sources),$(src),$(build)) -converter-tool-sources = \ - $(src)/binaryToObject/main.cpp +binary-to-object-depends = $(shell find $(src)/tools/binary-to-object/ -name '*.h') +binary-to-object-sources = $(shell find $(src)/tools/binary-to-object/ -name '*.cpp') +binary-to-object-objects = $(call cpp-objects,$(binary-to-object-sources),$(src),$(build)) + +converter-sources = $(object-writer-sources) + +converter-tool-depends = $(binary-to-object-depends) $(all-depends) +converter-tool-sources = $(binary-to-object-sources) converter-objects = $(call cpp-objects,$(converter-sources),$(src),$(build)) converter-tool-objects = $(call cpp-objects,$(converter-tool-sources),$(src),$(build)) @@ -1497,11 +1499,12 @@ $(boot-object): $(boot-source) $(boot-javahome-object): $(src)/boot-javahome.cpp $(compile-object) -$(converter-objects) $(converter-tool-objects): $(build)/binaryToObject/%.o: $(src)/binaryToObject/%.cpp $(converter-depends) +$(object-writer-objects) $(binary-to-object-objects): $(build)/%.o: $(src)/%.cpp $(binary-to-object-depends) $(object-writer-depends) $(all-depends) @mkdir -p $(dir $(@)) $(build-cxx) $(converter-cflags) -c $(<) -o $(@) $(converter): $(converter-objects) $(converter-tool-objects) + @mkdir -p $(dir $(@)) $(build-cc) $(^) -g -o $(@) $(lzma-encoder-objects): $(build)/lzma/%.o: $(src)/lzma/%.cpp diff --git a/src/bootimage.cpp b/src/bootimage.cpp index 0dba4af877..05fef8158d 100644 --- a/src/bootimage.cpp +++ b/src/bootimage.cpp @@ -17,7 +17,7 @@ #include "codegen/assembler.h" #include "codegen/promise.h" #include "target.h" -#include "binaryToObject/tools.h" +#include #include "lzma.h" // since we aren't linking against libstdc++, we must implement this diff --git a/src/binaryToObject/main.cpp b/src/tools/binary-to-object/main.cpp similarity index 98% rename from src/binaryToObject/main.cpp rename to src/tools/binary-to-object/main.cpp index fe389f3d29..86d780bbec 100644 --- a/src/binaryToObject/main.cpp +++ b/src/tools/binary-to-object/main.cpp @@ -22,7 +22,7 @@ #endif #include -#include "tools.h" +#include extern "C" void __cxa_pure_virtual() { diff --git a/src/binaryToObject/elf.cpp b/src/tools/object-writer/elf.cpp similarity index 99% rename from src/binaryToObject/elf.cpp rename to src/tools/object-writer/elf.cpp index a2277c3488..bf220e1e04 100644 --- a/src/binaryToObject/elf.cpp +++ b/src/tools/object-writer/elf.cpp @@ -15,7 +15,7 @@ #include "endianness.h" -#include "tools.h" +#include #define EI_NIDENT 16 diff --git a/src/binaryToObject/endianness.h b/src/tools/object-writer/endianness.h similarity index 100% rename from src/binaryToObject/endianness.h rename to src/tools/object-writer/endianness.h diff --git a/src/binaryToObject/mach-o.cpp b/src/tools/object-writer/mach-o.cpp similarity index 99% rename from src/binaryToObject/mach-o.cpp rename to src/tools/object-writer/mach-o.cpp index 96dd63aafd..fac134f272 100644 --- a/src/binaryToObject/mach-o.cpp +++ b/src/tools/object-writer/mach-o.cpp @@ -14,7 +14,7 @@ #include "endianness.h" -#include "tools.h" +#include #define MH_MAGIC_64 0xfeedfacf #define MH_MAGIC 0xfeedface diff --git a/src/binaryToObject/pe.cpp b/src/tools/object-writer/pe.cpp similarity index 99% rename from src/binaryToObject/pe.cpp rename to src/tools/object-writer/pe.cpp index 186e491447..0fdc4a16e0 100644 --- a/src/binaryToObject/pe.cpp +++ b/src/tools/object-writer/pe.cpp @@ -13,7 +13,7 @@ #include #include -#include "tools.h" +#include namespace { diff --git a/src/binaryToObject/tools.cpp b/src/tools/object-writer/tools.cpp similarity index 98% rename from src/binaryToObject/tools.cpp rename to src/tools/object-writer/tools.cpp index 9cc9059b93..49726245c7 100644 --- a/src/binaryToObject/tools.cpp +++ b/src/tools/object-writer/tools.cpp @@ -13,7 +13,7 @@ #include #include -#include "tools.h" +#include namespace avian {