summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-02-03 19:00:40 -0500
committermidipix <writeonce@midipix.org>2016-02-03 19:00:40 -0500
commitb895c9b68b195c13bf5636d6a612d43a3f102e43 (patch)
treec5c0fa14bb15e340c7ce2a65f33ed30fcb110e34
parent42e9824d73323ea9668cb8b0b7e0d24bdd0faff7 (diff)
downloadntcon-b895c9b68b195c13bf5636d6a612d43a3f102e43.tar.bz2
ntcon-b895c9b68b195c13bf5636d6a612d43a3f102e43.tar.xz
project: switch to a free-standing build profile.
-rw-r--r--Makefile.in2
-rw-r--r--project/defs.mk24
-rw-r--r--project/extras.mk35
-rw-r--r--project/overrides.mk6
-rw-r--r--sysinfo/os/midipix.mk2
-rw-r--r--sysinfo/os/mingw.mk19
6 files changed, 40 insertions, 48 deletions
diff --git a/Makefile.in b/Makefile.in
index 274304c..21e93fb 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -79,7 +79,7 @@ src/%.o: $(PROJECT_DIR)/src/%.c $(ALL_HEADERS) host.tag tree.tag
$(CC) -c -o $@ $< $(CFLAGS_STATIC)
$(LIBDIR)/%$(OS_LIB_SUFFIX):
- $(CC) -shared -o $@ $^ $(LDFLAGS_SHARED)
+ $(LD) -shared -o $@ $^ $(LDFLAGS_SHARED)
$(LIBDIR)/%$(OS_ARCHIVE_EXT):
rm -f $@
diff --git a/project/defs.mk b/project/defs.mk
index d6212fe..1f352be 100644
--- a/project/defs.mk
+++ b/project/defs.mk
@@ -2,25 +2,25 @@ SHARED_LIB_DEPS =
SHARED_APP_DEPS =
STATIC_APP_DEPS =
-COMMON_LOBJS = $(COMMON_SRCS:.c=.lo)
-COMMON_OBJS = $(COMMON_SRCS:.c=.o)
+COMMON_LOBJS = $(COMMON_SRCS:.c=.lo)
+COMMON_OBJS = $(COMMON_SRCS:.c=.o)
-ARCH_LOBJS = $(ARCH_SRCS:.c=.lo)
-ARCH_OBJS = $(ARCH_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_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)
+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_COMMON) $(CFLAGS_CMDLINE) $(CFLAGS_HOST) \
$(CFLAGS_PATH)
-CFLAGS_SHARED = $(CFLAGS) $(CFLAGS_PIC) $(CFLAGS_SHARED_ATTR)
-CFLAGS_STATIC = $(CFLAGS) $(CFLAGS_OBJ) $(CFLAGS_STATIC_ATTR)
+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) \
diff --git a/project/extras.mk b/project/extras.mk
index 57b0f11..e319e4e 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -1,27 +1,16 @@
-CFLAGS_SHARED_ATTR += -DNTCON_BUILD
-CFLAGS_STATIC_ATTR += -DNTCON_STATIC
+CFLAGS_SHARED_ATTR += -DNTCON_BUILD
+CFLAGS_STATIC_ATTR += -DNTCON_STATIC
-ifeq ($(OS),midipix)
- HOST_FMT = pe
-else ifeq ($(OS),mingw)
- HOST_FMT = pe
-else
- HOST_FMT = unknown
-endif
+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__
-ifeq ($(HOST_FMT),pe)
- 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
+LDFLAGS_SHARED += -lpemagine
- LDFLAGS_SHARED += -nostdlib
- LDFLAGS_SHARED += -lpemagine
- LDFLAGS_SHARED += -Wl,--out-implib,$(SHARED_IMPLIB)
- LDFLAGS_SHARED += -Wl,--exclude-all-symbols
-
- ifeq ($(HOST_BITS),32)
- LDFLAGS_SHARED += -Wl,--entry,$(HOST_UNDERSCORE)ntcon_entry_point@12
- else
- LDFLAGS_SHARED += -Wl,--entry,$(HOST_UNDERSCORE)ntcon_entry_point
- endif
+ifeq ($(HOST_BITS),32)
+ LDFLAGS_SHARED += --entry $(HOST_UNDERSCORE)ntcon_entry_point@12
+else
+ LDFLAGS_SHARED += --entry $(HOST_UNDERSCORE)ntcon_entry_point
endif
diff --git a/project/overrides.mk b/project/overrides.mk
index e69de29..2a67ff9 100644
--- a/project/overrides.mk
+++ b/project/overrides.mk
@@ -0,0 +1,6 @@
+# direct linker invocation
+LDFLAGS_SYSROOT = $(CFLAGS_SYSROOT)
+
+ifneq ($(PE_SUBSYSTEM)x,x)
+ LDFLAGS_COMMON += --subsystem=$(PE_SUBSYSTEM)
+endif
diff --git a/sysinfo/os/midipix.mk b/sysinfo/os/midipix.mk
index 4a92e62..68766d1 100644
--- a/sysinfo/os/midipix.mk
+++ b/sysinfo/os/midipix.mk
@@ -7,8 +7,6 @@ OS_IMPLIB_EXT = .lib.a
OS_LIBDEF_EXT = .so.def
OS_ARCHIVE_EXT = .a
-LDFLAGS_CONFIG += -mout-implib
-
install-implib: shared-implib
mkdir -p $(DESTDIR)///./$(PREFIX)/./$(LIBDIR)
cp $(SHARED_IMPLIB) $(DESTDIR)///./$(PREFIX)/./$(LIBDIR)
diff --git a/sysinfo/os/mingw.mk b/sysinfo/os/mingw.mk
index 75c9667..1a66aba 100644
--- a/sysinfo/os/mingw.mk
+++ b/sysinfo/os/mingw.mk
@@ -1,14 +1,13 @@
-OS = mingw
-OS_APP_PREFIX =
-OS_APP_SUFFIX = .exe
-OS_LIB_PREFIX = lib
-OS_LIB_SUFFIX = .dll
-OS_IMPLIB_EXT = .a
-OS_LIBDEF_EXT = .def
-OS_ARCHIVE_EXT = .a
+OS = mingw
+OS_APP_PREFIX =
+OS_APP_SUFFIX = .exe
+OS_LIB_PREFIX = lib
+OS_LIB_SUFFIX = .dll
+OS_IMPLIB_EXT = .dll.a
+OS_LIBDEF_EXT = .def
+OS_ARCHIVE_EXT = .a
-CFLAGS_PIC =
-LDFLAGS_CONFIG += -Wl,--out-implib,$(SHARED_IMPLIB)
+CFLAGS_PIC =
install-implib: shared-implib
mkdir -p $(DESTDIR)///./$(PREFIX)/./$(LIBDIR)