summaryrefslogtreecommitdiffhomepage
path: root/project
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2015-09-25 22:17:03 -0400
committermidipix <writeonce@midipix.org>2015-09-26 11:10:25 -0400
commit18eb4842536d1c9df278e7f65c16ce5679b99d39 (patch)
tree8ba10e3d909ead6f145d442342fed5cfa6277e6f /project
parent712b5fd9b720c18cc53d5627566525b96da3163f (diff)
downloadpemagine-18eb4842536d1c9df278e7f65c16ce5679b99d39.tar.bz2
pemagine-18eb4842536d1c9df278e7f65c16ce5679b99d39.tar.xz
makefile replacement: step 2/2: use the midipix build template.
Diffstat (limited to 'project')
-rw-r--r--project/arch.mk0
-rw-r--r--project/common.mk21
-rw-r--r--project/defs.mk31
-rw-r--r--project/depends.mk0
-rw-r--r--project/extras.mk15
-rw-r--r--project/headers.mk19
-rw-r--r--project/overrides.mk0
-rw-r--r--project/tree.mk9
8 files changed, 95 insertions, 0 deletions
diff --git a/project/arch.mk b/project/arch.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/arch.mk
diff --git a/project/common.mk b/project/common.mk
new file mode 100644
index 0000000..4c74d04
--- /dev/null
+++ b/project/common.mk
@@ -0,0 +1,21 @@
+COMMON_SRCS = \
+ src/exports/pe_enum_image_exports.c \
+ src/exports/pe_get_export_symbol_info.c \
+ src/exports/pe_get_procedure_address.c \
+ src/headers/pe_get_image_coff_hdr_addr.c \
+ src/headers/pe_get_image_data_dirs_addr.c \
+ src/headers/pe_get_image_dos_hdr_addr.c \
+ src/headers/pe_get_image_entry_point_addr.c \
+ src/headers/pe_get_image_opt_hdr_addr.c \
+ src/headers/pe_get_image_section_tbl_addr.c \
+ src/headers/pe_get_image_special_hdr_addr.c \
+ src/imports/pe_enum_image_import_hdrs.c \
+ src/internal/pe_impl.c \
+ src/internal/pe_lib_entry_point.c \
+ src/meta/pe_get_image_stack_heap_info.c \
+ src/meta/pe_get_symbol_module_info.c \
+ src/meta/pe_get_symbol_name.c \
+ src/modules/pe_enum_modules.c \
+ src/modules/pe_get_kernel32_module_handle.c \
+ src/modules/pe_get_module_handle.c \
+ src/modules/pe_get_ntdll_module_handle.c \
diff --git a/project/defs.mk b/project/defs.mk
new file mode 100644
index 0000000..1f352be
--- /dev/null
+++ b/project/defs.mk
@@ -0,0 +1,31 @@
+SHARED_LIB_DEPS =
+SHARED_APP_DEPS =
+STATIC_APP_DEPS =
+
+COMMON_LOBJS = $(COMMON_SRCS:.c=.lo)
+COMMON_OBJS = $(COMMON_SRCS:.c=.o)
+
+ARCH_LOBJS = $(ARCH_SRCS:.c=.lo)
+ARCH_OBJS = $(ARCH_SRCS:.c=.o)
+
+SHARED_OBJS = $(COMMON_LOBJS) $(ARCH_LOBJS)
+STATIC_OBJS = $(COMMON_OBJS) $(ARCH_OBJS)
+
+SHARED_LIB = $(LIBDIR)/$(OS_LIB_PREFIX)$(PACKAGE)$(OS_LIB_SUFFIX)
+STATIC_LIB = $(LIBDIR)/$(OS_LIB_PREFIX)$(PACKAGE)$(OS_ARCHIVE_EXT)
+SHARED_IMPLIB = $(LIBDIR)/$(OS_LIB_PREFIX)$(PACKAGE)$(OS_IMPLIB_EXT)
+
+CFLAGS = $(CFLAGS_DEBUG) $(CFLAGS_CONFIG) $(CFLAGS_SYSROOT) \
+ $(CFLAGS_COMMON) $(CFLAGS_CMDLINE) $(CFLAGS_HOST) \
+ $(CFLAGS_PATH)
+
+CFLAGS_SHARED = $(CFLAGS) $(CFLAGS_PIC) $(CFLAGS_SHARED_ATTR)
+CFLAGS_STATIC = $(CFLAGS) $(CFLAGS_OBJ) $(CFLAGS_STATIC_ATTR)
+
+LDFLAGS_SHARED = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
+ $(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
+ $(LDFLAGS_PATH) $(SHARED_LIB_DEPS) $(LDFLAGS_LAST)
+
+LDFLAGS_STATIC = $(LDFLAGS_DEBUG) $(LDFLAGS_CONFIG) $(LDFLAGS_SYSROOT) \
+ $(LDFLAGS_COMMON) $(LDFLAGS_CMDLINE) $(LDFLAGS_HOST) \
+ $(LDFLAGS_PATH) $(STATIC_APP_DEPS) $(LDFLAGS_LAST)
diff --git a/project/depends.mk b/project/depends.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/depends.mk
diff --git a/project/extras.mk b/project/extras.mk
new file mode 100644
index 0000000..2af3716
--- /dev/null
+++ b/project/extras.mk
@@ -0,0 +1,15 @@
+CFLAGS_SHARED_ATTR += -DPE_BUILD
+CFLAGS_STATIC_ATTR += -DPE_STATIC
+
+CFLAGS_CONFIG += -DMIDIPIX_FREESTANDING -ffreestanding -D__NT$(HOST_BITS)
+CFLAGS_CONFIG += -UWIN32 -U_WIN32 -U__WIN32 -U__WIN32__
+CFLAGS_CONFIG += -UWIN64 -U_WIN64 -U__WIN64 -U__WIN64__
+
+LDFLAGS_SHARED += --out-implib $(SHARED_IMPLIB)
+LDFLAGS_SHARED += --exclude-all-symbols
+
+ifeq ($(HOST_BITS),32)
+ LDFLAGS_SHARED += --entry $(HOST_UNDERSCORE)pe_lib_entry_point@12
+else
+ LDFLAGS_SHARED += --entry $(HOST_UNDERSCORE)pe_lib_entry_point
+endif
diff --git a/project/headers.mk b/project/headers.mk
new file mode 100644
index 0000000..d89e2fd
--- /dev/null
+++ b/project/headers.mk
@@ -0,0 +1,19 @@
+API_HEADERS = \
+ $(PROJECT_DIR)/include/pemagine/pemagine.h \
+ $(PROJECT_DIR)/include/pemagine/pe_api.h \
+ $(PROJECT_DIR)/include/pemagine/pe_consts.h \
+ $(PROJECT_DIR)/include/pemagine/pe_inline_asm.h \
+ $(PROJECT_DIR)/include/pemagine/pe_structs.h \
+
+API_HEADERS_NT32 = \
+ $(PROJECT_DIR)/include/pemagine/bits/nt32/pe_inline_asm__gcc.h \
+ $(PROJECT_DIR)/include/pemagine/bits/nt32/pe_inline_asm__msvc.h \
+
+API_HEADERS_NT64 = \
+ $(PROJECT_DIR)/include/pemagine/bits/nt64/pe_inline_asm__gcc.h \
+ $(PROJECT_DIR)/include/pemagine/bits/nt64/pe_inline_asm__msvc.h \
+
+INTERNAL_HEADERS = \
+ $(PROJECT_DIR)/src/internal/pe_impl.h
+
+ALL_HEADERS = $(API_HEADERS) $(INTERNAL_HEADERS) $(API_HEADERS_NT32) $(API_HEADERS_NT64)
diff --git a/project/overrides.mk b/project/overrides.mk
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/overrides.mk
diff --git a/project/tree.mk b/project/tree.mk
new file mode 100644
index 0000000..08c47de
--- /dev/null
+++ b/project/tree.mk
@@ -0,0 +1,9 @@
+tree.tag:
+ mkdir -p src
+ mkdir -p src/exports
+ mkdir -p src/headers
+ mkdir -p src/imports
+ mkdir -p src/internal
+ mkdir -p src/meta
+ mkdir -p src/modules
+ touch tree.tag