gcc_linux.mk 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. #############################################################################
  2. #
  3. # SciTech Multi-platform Graphics Library
  4. #
  5. # ========================================================================
  6. #
  7. # The contents of this file are subject to the SciTech MGL Public
  8. # License Version 1.0 (the "License"); you may not use this file
  9. # except in compliance with the License. You may obtain a copy of
  10. # the License at http://www.scitechsoft.com/mgl-license.txt
  11. #
  12. # Software distributed under the License is distributed on an
  13. # "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  14. # implied. See the License for the specific language governing
  15. # rights and limitations under the License.
  16. #
  17. # The Original Code is Copyright (C) 1991-1998 SciTech Software, Inc.
  18. #
  19. # The Initial Developer of the Original Code is SciTech Software, Inc.
  20. # All Rights Reserved.
  21. #
  22. # ========================================================================
  23. #
  24. # Descripton: Generic DMAKE startup makefile definitions file. Assumes
  25. # that the SCITECH environment variable has been set to point
  26. # to where all our stuff is installed. You should not need
  27. # to change anything in this file.
  28. #
  29. # Linux version for GNU C/C++.
  30. #
  31. #############################################################################
  32. # Include standard startup script definitions
  33. .IMPORT: SCITECH
  34. .INCLUDE: "$(SCITECH)/makedefs/startup.mk"
  35. # Import enivornment variables that we use
  36. .IMPORT .IGNORE : GCC2_LIBBASE
  37. # Override some file suffix definitions
  38. L := .a # Libraries
  39. O := .o # Objects
  40. # Override the file prefix/suffix definitions for library naming.
  41. LP := lib # LP - Library file prefix (name of file on disk)
  42. LL := -l # Library link prefix (name of library on link command line)
  43. LE := # Library link suffix (extension of library on link command line)
  44. # We are compiling for a 32 bit envionment
  45. _32BIT_ := 1
  46. # Define that we are compiling for Linux
  47. USE_LINUX := 1
  48. # Default commands for compiling, assembling linking and archiving.
  49. CC := gcc
  50. CFLAGS := -Wall -I. -Iinclude -I$(SCITECH:s,\,/)/include -I$(PRIVATE:s,\,/)/include
  51. SHOW_CFLAGS := -c
  52. CXX := g++
  53. AS := nasm
  54. ASFLAGS := -t -f elf -d__FLAT__ -d__GNUC__ -iinclude -i$(SCITECH)/include -d__NOU__
  55. SHOW_ASFLAGS := -f elf
  56. LD := gcc
  57. LDXX := g++
  58. LDFLAGS := -L.
  59. LIB := ar
  60. LIBFLAGS := rcs
  61. YACC := bison -y
  62. LEX := flex
  63. SED := sed
  64. # Optionally turn on debugging information
  65. .IF $(DBG)
  66. CFLAGS += -g
  67. SHOW_CFLAGS += -g
  68. .ELSE
  69. # NASM does not support debugging information yet
  70. ASFLAGS +=
  71. .ENDIF
  72. # Optionally turn on optimisations
  73. .IF $(OPT_MAX)
  74. CFLAGS += -O6
  75. SHOW_CFLAGS += -O6
  76. .ELIF $(OPT)
  77. CFLAGS += -O2
  78. SHOW_CFLAGS += -O2
  79. .ELIF $(OPT_SIZE)
  80. CFLAGS += -O1
  81. SHOW_CFLAGS += -O1
  82. .ENDIF
  83. # Optionally turn on direct i387 FPU instructions
  84. .IF $(FPU)
  85. CFLAGS += -DFPU387
  86. ASFLAGS += -dFPU387
  87. .END
  88. # Optionally compile a beta release version of a product
  89. .IF $(BETA)
  90. CFLAGS += -DBETA
  91. SHOW_CFLAGS += -DBETA
  92. ASFLAGS += -dBETA
  93. SHOW_ASFLAGS += -dBETA
  94. .ENDIF
  95. # Disable standard C runtime library
  96. .IF $(NO_RUNTIME)
  97. CFLAGS += -fno-builtin -nostdinc
  98. .ENDIF
  99. # Compile flag for whether to build X11 or non-X11 lib
  100. .IF $(USE_X11)
  101. CFLAGS += -D__X11__
  102. .ENDIF
  103. # Target environment dependant flags
  104. CFLAGS += -D__LINUX__
  105. ASFLAGS += -d__LINUX__ -d__UNIX__
  106. # Define the base directory for library files
  107. .IF $(CHECKED)
  108. LIB_BASE_DIR := $(SCITECH_LIB)/lib/debug
  109. CFLAGS += -DCHECKED=1
  110. SHOW_CFLAGS += -DCHECKED=1
  111. .ELSE
  112. LIB_BASE_DIR := $(SCITECH_LIB)/lib/release
  113. .ENDIF
  114. # Define where to install library files
  115. .IF $(LIBC)
  116. LIB_DEST_SHARED := $(LIB_BASE_DIR)/linux/gcc/libc.so
  117. LIB_DEST_STATIC := $(LIB_BASE_DIR)/linux/gcc/libc
  118. .ELSE
  119. LIB_DEST_SHARED := $(LIB_BASE_DIR)/linux/gcc/glibc.so
  120. LIB_DEST_STATIC := $(LIB_BASE_DIR)/linux/gcc/glibc
  121. .ENDIF
  122. # Link to static libraries if requested
  123. .IF $(STATIC_LIBS_ALL)
  124. LDFLAGS += -static
  125. STATIC_LIBS := 1
  126. .ENDIF
  127. # Link to static libraries if requested
  128. .IF $(STATIC_LIBS)
  129. LDFLAGS += -L$(LIB_DEST_STATIC)
  130. .ELSE
  131. LDFLAGS += -L$(LIB_DEST_SHARED) -L$(LIB_DEST_STATIC)
  132. .ENDIF
  133. # Optionally enable some dynamic libraries to be built
  134. .IF $(BUILD_DLL)
  135. .IF $(VERSIONMAJ)
  136. .ELSE
  137. VERSIONMAJ := 5
  138. VERSIONMIN := 0
  139. .ENDIF
  140. VERSION := $(VERSIONMAJ).$(VERSIONMIN)
  141. LIB := gcc -shared
  142. LIBFLAGS :=
  143. L := .so
  144. CFLAGS += -fPIC
  145. SHOW_CFLAGS += -fPIC
  146. ASFLAGS += -D__PIC__
  147. SHOW_ASFLAGS += -D__PIC__
  148. LIB_DEST := $(LIB_DEST_SHARED)
  149. .ELSE
  150. LIB_DEST := $(LIB_DEST_STATIC)
  151. .ENDIF
  152. # Place to look for PMODE library files
  153. PMLIB := -lpm
  154. # Define which file contains our rules
  155. RULES_MAK := gcc_linux.mk