summaryrefslogtreecommitdiff
path: root/makefiles/gmake/platform.mk
diff options
context:
space:
mode:
Diffstat (limited to 'makefiles/gmake/platform.mk')
-rw-r--r--makefiles/gmake/platform.mk56
1 files changed, 56 insertions, 0 deletions
diff --git a/makefiles/gmake/platform.mk b/makefiles/gmake/platform.mk
new file mode 100644
index 0000000..95843fb
--- /dev/null
+++ b/makefiles/gmake/platform.mk
@@ -0,0 +1,56 @@
+# sets e. g. to LINUX, OS_MAJOR_VERSION to 2 and OS_MINOR_VERSION to 6
+# by calling the 'guess_env' shell script, where the actual probing happens
+# Also sets PLATFORM_COMPILE_FLAGS to be included when compiling C/C++ code
+#
+# requires:
+# - TOPDIR
+#
+# provides:
+# - PLATFORM
+# - OS_MAJOR_VERSION and OS_MINOR_VERSION
+# - GCC_MAJOR_VERSION and GCC_MINOR_VERSION
+# - PLATFORM_COMPILE_FLAGS
+# - EXE
+# - SO
+# - INSTALL
+#
+# author: Andreas Baumann, abaumann at yahoo dot com
+
+PLATFORM = $(shell $(TOPDIR)/makefiles/gmake/guess_env --platform $(CC))
+OS_MAJOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-major-version $(CC))
+OS_MINOR_VERSION = $(shell $(TOPDIR)/makefiles/gmake/guess_env --os-minor-version $(CC))
+COMPILER = $(shell $(TOPDIR)/makefiles/gmake/guess_env --compiler $(CC))
+
+PLATFORM_COMPILE_FLAGS = \
+ -D$(PLATFORM) \
+ -DOS_MAJOR_VERSION=$(OS_MAJOR_VERSION) \
+ -DOS_MINOR_VERSION=$(OS_MINOR_VERSION)
+
+# extensions for binaries
+ifeq "$(PLATFORM)" "CYGWIN"
+EXE = .exe
+else
+EXE =
+endif
+
+# extensions for shared libraries
+# (TOOD: HP/Unix has .shlib, Mac/X has .lib, but we can't test it currently)
+SO = .so
+
+# name if the installation program
+# (TODO: use the MIT or openradio install-sh script instead?)
+INSTALL = $(shell $(TOPDIR)/makefiles/gmake/guess_env --install)
+ifeq "$(PLATFORM)" "SUNOS"
+INSTALL = /usr/ucb/install
+else
+INSTALL = install
+endif
+
+# the linker library for dynamically loadable modules
+# (TODO: check for all platforms, as soon we add loadable modules here from
+# old TextWolf)
+ifeq "$(PLATFORM)" "LINUX"
+LIBS_DL = -ldl
+else
+LIBS_DL =
+endif