Annotation of sbbs/build/common.gmake, revision 1.1

1.1     ! root        1: # build/Common.gmake
        !             2: #
        !             3: # Global build system setup file
        !             4: #
        !             5: # $Id: Common.gmake,v 1.30 2004/12/12 09:41:44 deuce Exp $
        !             6: #
        !             7: #############################################################################
        !             8: # @format.tab-size 4           (Plain Text/Source Code File Header)                    #
        !             9: # @format.use-tabs true        (see http://www.synchro.net/ptsc_hdr.html)                      #
        !            10: #                                                                                                                                                      #
        !            11: # Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html          #
        !            12: #                                                                                                                                                      #
        !            13: # This program is free software; you can redistribute it and/or                                #
        !            14: # modify it under the terms of the GNU General Public License                          #
        !            15: # as published by the Free Software Foundation; either version 2                       #
        !            16: # of the License, or (at your option) any later version.                                       #
        !            17: # See the GNU General Public License for more details: gpl.txt or                      #
        !            18: # http://www.fsf.org/copyleft/gpl.html                                                                         #
        !            19: #                                                                                                                                                      #
        !            20: # Anonymous FTP access to the most recent released source is available at      #
        !            21: # ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net      #
        !            22: #                                                                                                                                                      #
        !            23: # Anonymous CVS access to the development source and modification history      #
        !            24: # is available at cvs.synchro.net:/cvsroot/sbbs, example:                                      #
        !            25: # cvs -d :pserver:[email protected]:/cvsroot/sbbs login                                #
        !            26: #     (just hit return, no password is necessary)                                                      #
        !            27: # cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src         #
        !            28: #                                                                                                                                                      #
        !            29: # For Synchronet coding style and modification guidelines, see                         #
        !            30: # http://www.synchro.net/source.html                                                                           #
        !            31: #                                                                                                                                                      #
        !            32: # You are encouraged to submit any modifications (preferably in Unix diff      #
        !            33: # format) via e-mail to [email protected]                                                                       #
        !            34: #                                                                                                                                                      #
        !            35: # Note: If this box doesn't appear square, then you need to fix your tabs.     #
        !            36: #############################################################################
        !            37: #                                                                                                                                                      #
        !            38: #############################################################################
        !            39: #                                                                                                                                                      #
        !            40: # Common macro setup for GNU make                                                                                      #
        !            41: #                                                                                                                                                      #
        !            42: # Common Build Macros REQUIRED:                                                                                                #
        !            43: #  SRC_ROOT                    - *MUST* be set to the src dir                                                  #
        !            44: #                                                                                                                                                      #
        !            45: # Common Build Macros Used:                                                                                                    #
        !            46: #  DEBUG                       - Create a debug build                                                                  #
        !            47: #  RELEASE                     - Create a release build                                                                #
        !            48: #                                        (Mutually exclusive, if both are set, RELEASE                 #
        !            49: #                                              is cleared)                                                                                     #
        !            50: #  DONT_CLOBBER_CC     - Do not change the default setting of CC                               #
        !            51: #  OBJPATH_SUFFIX      - Suffix appended to OBJPATH usefull for compiling              #
        !            52: #                                        different options of the same source file                             #
        !            53: #                                                                                                                                                      #
        !            54: # Common Build Macros Defined:                                                                                         #
        !            55: #  DELETE                      - Delete files (Preferrably verbose)                                    #
        !            56: #  MTOBJODIR           - Object output dir                                                                             #
        !            57: #  OBJODIR                     - Object output dir                                                                             #
        !            58: #  LIBODIR                     - Library output dir                                                                    #
        !            59: #  EXEODIR                     - Executable output dir                                                                 #
        !            60: #  DEBUG                       - Set for debug builds                                                                  #
        !            61: #  RELEASE                     - Set for release builds                                                                #
        !            62: #                                        One of DEBUG or RELEASE is always set!                                #
        !            63: #  QUIET                       - Target command prefix to show/not show commands               #
        !            64: #                                        (Toggled off by setting VERBOSE)                                              #
        !            65: #  CFLAGS                      - Common C and C++ compiler flags                                               #
        !            66: #  CCFLAGS                     - C specific compiler flags                                                             #
        !            67: #  CXXFLAGS                    - C++ specific compiler flags                                                   #
        !            68: #  LDFLAGS                     - Linker flags                                                                                  #
        !            69: #  CC                          - C compiler                                                                                    #
        !            70: #  CXX                         - C++ compiler                                                                                  #
        !            71: #  EXEFILE                     - Executable file extension (Includes .)                                #
        !            72: #  OFILE                       - Object file extension (Includes .)                                    #
        !            73: #  SOFILE                      - Shared object (DLL) file extension (Includes .)               #
        !            74: #  LIBFILE                     - Static library file extension (Include .)                             #
        !            75: #  LIBPREFIX           - Prefix to library filename                                                    #
        !            76: #  LIBS                                - Library names (Appropriate for dependencies)                  #
        !            77: #  LIB_LDFLAGS         - Libraries appropriate for link command-line usage             #
        !            78: #  COMPILE_MSG         - Message saying a target is being compiled                             #
        !            79: #  DIRSEP                      - The directory seperator this system likes most                #
        !            80: #  VERSION                     - Synchronet version number in MAJOR.MINOR format               #
        !            81: #                                        (Numeric ONLY)                                                                                #
        !            82: #  OUTPUT                      - Compiler flag specifying output filename                              #
        !            83: #  LOUTPUT                     - Linker flag specifying output filename                                #
        !            84: #  XPDEV_SRC           - Path to xpdev                                                                                 #
        !            85: #  UIFC_SRC                    - Path to uifc                                                                                  #
        !            86: #  CIOLIB_SRC          - Path to ciolib                                                                                #
        !            87: #  SMBLIB_SRC          - Path to smblib                                                                                #
        !            88: #  MT_CFLAGS           - CFLAGS for building MT objects                                                #
        !            89: #  MT_LDFLAGS          - LDFLAGS for linking MT targets                                                #
        !            90: #  UL_PRE                      - Use Library prefix (*nix is -l)                                               #
        !            91: #  UL_SUF                      - Use Library siffix (bcc is .lib)                                              #
        !            92: #                                                                                                                                                      #
        !            93: # Common Targets Defined:                                                                                                      #
        !            94: #  Implicit C and C++ targets                                                                                          #
        !            95: #  "clean" target                                                                                                                      # 
        !            96: #  Output directory targets                                                                                                    #
        !            97: #                                                                                                                                                      #
        !            98: #############################################################################
        !            99: 
        !           100: # Set VERSION
        !           101: ifndef VERSION
        !           102:  VERSION       :=      3.12
        !           103: endif
        !           104: 
        !           105: # Put local (optional) macro definitions in localdefs.mk
        !           106: -include localdefs.mk
        !           107: -include $(SRC_ROOT)/build/localdefs.mk
        !           108: 
        !           109: # Set DEBUG
        !           110: ifdef DEBUG
        !           111:  ifdef RELEASE
        !           112:   undef RELEASE
        !           113:  endif
        !           114: endif
        !           115: 
        !           116: ifndef DEBUG
        !           117:  ifndef RELEASE
        !           118:   DEBUG        :=      1
        !           119:  endif
        !           120: endif
        !           121: 
        !           122: # VERBOSE/QUIET
        !           123: ifndef VERBOSE
        !           124:  QUIET :=      @
        !           125: endif
        !           126: 
        !           127: # Compiler-specific options
        !           128: CFLAGS +=      -MMD
        !           129: ifdef BUILD_DEPENDS
        !           130:  ifdef DONT_CLOBBER_CC
        !           131:   CC                   ?=      gcc
        !           132:  else
        !           133:   CC                   :=      gcc
        !           134:  endif
        !           135:  CCPRE                 :=      $(CC)
        !           136:  CC                            :=      $(SRC_ROOT)/build/mkdep -a
        !           137:  CXX                   :=      $(SRC_ROOT)/build/mkdep -a
        !           138:  LD                            :=      echo
        !           139:  COMPILE_MSG   :=  Depending
        !           140:  AR                            :=      echo
        !           141:  RANLIB                        :=      echo
        !           142: else
        !           143:  ifdef DONT_CLOBBER_CC
        !           144:   CC                   ?=      gcc
        !           145:  else
        !           146:   CC                   :=      gcc
        !           147:  endif
        !           148:  CCPRE                 :=      $(CC)
        !           149:  CXX                   ?=      g++
        !           150:  LD                            ?=      ld
        !           151:  COMPILE_MSG   := Compiling
        !           152:  AR                            ?=      ar
        !           153:  RANLIB                        ?=      ranlib
        !           154: endif
        !           155: 
        !           156: ifdef DEBUG
        !           157:  BUILD =       debug
        !           158: else
        !           159:  BUILD =       release
        !           160: endif
        !           161: BUILDPATH      ?=      $(BUILD)
        !           162: 
        !           163: # Get OS
        !           164: ifndef os
        !           165:  os            :=      $(shell uname)
        !           166: endif
        !           167: os      :=     $(shell echo $(os) | tr '[A-Z]' '[a-z]' | tr ' ' '_')
        !           168: 
        !           169: machine                :=      $(shell if uname -m | egrep -v "(i[3456789]|x)86" > /dev/null; then uname -m | tr "[A-Z]" "[a-z]" | tr " " "_" ; fi)
        !           170: ifeq ($(machine),sun4u)
        !           171:  CFLAGS +=      -D__BIG_ENDIAN__
        !           172: endif
        !           173: ifeq ($(machine),)
        !           174:  machine       :=      $(os)
        !           175: else
        !           176:  machine       :=      $(os).$(machine)
        !           177: endif
        !           178: 
        !           179: LIBODIR :=     $(CCPRE).$(machine).lib.$(BUILDPATH)
        !           180: OBJODIR :=     $(CCPRE).$(machine).obj.$(BUILDPATH)
        !           181: MTOBJODIR :=   $(CCPRE).$(machine).obj.$(BUILDPATH)-mt
        !           182: EXEODIR :=     $(CCPRE).$(machine).exe.$(BUILDPATH)
        !           183: LDFLAGS        +=      -L$(LIBODIR)
        !           184: 
        !           185: ifeq ($(os),openbsd)
        !           186:  DELETE :=     rm -f
        !           187: else
        !           188:  ifeq ($(os),sunos)
        !           189:   DELETE :=    rm -f
        !           190:  else
        !           191:   DELETE       =       rm -fv
        !           192:  endif
        !           193: endif
        !           194: 
        !           195: LIBPREFIX      := lib
        !           196: DIRSEP         := /
        !           197: OFILE          := .o
        !           198: EXEFILE                :=
        !           199: SOFILE         := .so
        !           200: LIBFILE                := .a
        !           201: UL_PRE         :=      -l
        !           202: UL_SUF         :=      
        !           203: 
        !           204: OUTPUT         :=      -o
        !           205: LOUTPUT                :=      -o
        !           206: 
        !           207: ifeq ($(os),openbsd)
        !           208:  SOFILE        :=      $(SOFILE).$(VERSION)
        !           209: else
        !           210:  ifeq ($(os),darwin)
        !           211:   SOFILE =     .dylib
        !           212:  endif
        !           213: endif
        !           214: 
        !           215: # OS Specific Flags
        !           216: ifeq ($(os),sunos)    # Solaris
        !           217:  CFLAGS        += -D__solaris__ -DNEEDS_DAEMON -DNEEDS_FORKPTY -DNEEDS_SETENV -DNEEDS_CFMAKERAW
        !           218: endif
        !           219: ifeq ($(os),netbsd)    # NetBSD
        !           220:  CFLAGS        +=      -D__unix__ -I/usr/pkg/include
        !           221: endif
        !           222: ifeq ($(os),darwin)
        !           223:  CFLAGS +=  -D__unix__ -fno-common -D__DARWIN__
        !           224:  LDFLAGS +=  -lm
        !           225: endif
        !           226: 
        !           227: # PThread-specific flags
        !           228: ifeq ($(os),linux)    # Linux
        !           229:  ifndef THREADS_ACTUALLY_WORK
        !           230:   CFLAGS    += -D_THREAD_SUID_BROKEN
        !           231:  endif
        !           232: endif
        !           233: MT_CFLAGS    += -D_THREAD_SAFE -D_REENTRANT
        !           234: ifeq ($(os),freebsd)    # FreeBSD
        !           235:  MT_CFLAGS    += -DUSE_XP_SEMAPHORES
        !           236:  MT_LDFLAGS    +=    -pthread
        !           237:  XP_SEM    :=    1
        !           238: else
        !           239:  ifeq ($(os),openbsd)    # OpenBSD
        !           240:   MT_CFLAGS    += -DUSE_XP_SEMAPHORES
        !           241:   MT_LDFLAGS    +=    -pthread
        !           242:   XP_SEM    :=    1
        !           243:  else
        !           244:   ifeq ($(os),netbsd)    # NetBSD
        !           245:    MT_CFLAGS   +=      -DUSE_XP_SEMAPHORES
        !           246:    MT_LDFLAGS    +=   -L/usr/pkg/lib -lpthread
        !           247:    XP_SEM    :=    1
        !           248:   else
        !           249:    ifeq ($(os),qnx)    # QNX
        !           250:    else
        !           251:     ifeq ($(os),darwin)    # Darwin/Mac OS X
        !           252:      CFLAGS    += -D__unix__ 
        !           253:      MT_CFLAGS    += -DUSE_XP_SEMAPHORES -D__DARWIN__
        !           254:      MT_LDFLAGS    += -lpthread
        !           255:      XP_SEM    := 1
        !           256:     else
        !           257:      ifeq ($(os),sunos)  # Solaris
        !           258:       XP_SEM :=    1
        !           259:       MT_CFLAGS    +=    -D_POSIX_PTHREAD_SEMANTICS
        !           260:       MT_CFLAGS    += -DUSE_XP_SEMAPHORES
        !           261:       MT_LDFLAGS    +=    -lpthread
        !           262:      else            # Linux / Other UNIX
        !           263:       XP_SEM :=    1
        !           264:       MT_CFLAGS    += -DUSE_XP_SEMAPHORES
        !           265:       MT_LDFLAGS    +=    -lpthread
        !           266:      endif
        !           267:     endif
        !           268:    endif
        !           269:   endif
        !           270:  endif
        !           271: endif
        !           272: 
        !           273: # Paths
        !           274: XPDEV_SRC      :=      $(SRC_ROOT)$(DIRSEP)xpdev
        !           275: CIOLIB_SRC     :=      $(SRC_ROOT)$(DIRSEP)conio
        !           276: SMBLIB_SRC     :=      $(SRC_ROOT)$(DIRSEP)smblib
        !           277: UIFC_SRC       :=      $(SRC_ROOT)$(DIRSEP)uifc
        !           278: 
        !           279: # Pull in lib-specific flags
        !           280: include                $(CIOLIB_SRC)$(DIRSEP)Common.make
        !           281: include                $(UIFC_SRC)$(DIRSEP)Common.make
        !           282: include                $(SMBLIB_SRC)$(DIRSEP)Common.make
        !           283: include                $(XPDEV_SRC)$(DIRSEP)Common.make
        !           284: -include               $(CIOLIB_SRC)$(DIRSEP)Common.gmake
        !           285: -include               $(UIFC_SRC)$(DIRSEP)Common.gmake
        !           286: -include               $(SMBLIB_SRC)$(DIRSEP)Common.gmake
        !           287: -include               $(XPDEV_SRC)$(DIRSEP)Common.gmake
        !           288: 
        !           289: ifdef DEBUG
        !           290:  CFLAGS        +=      -ggdb
        !           291:  CFLAGS        +=      -D_DEBUG
        !           292: else # RELEASE
        !           293:  CFLAGS        := -O3 $(CFLAGS)
        !           294: endif
        !           295: 
        !           296: -include targets.mk
        !           297: -include $(SRC_ROOT)/build/rules.mk
        !           298: -include objects.mk            # defines $(OBJS)
        !           299: 
        !           300: # Implicit C Compile Rule
        !           301: $(OBJODIR)/%$(OFILE) : %.c $(BUILD_DEPENDS)
        !           302:        @echo $(COMPILE_MSG) $<
        !           303:        $(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) -o $@ -c $<
        !           304: 
        !           305: # Implicit C++ Compile Rule
        !           306: $(OBJODIR)/%$(OFILE) : %.cpp $(BUILD_DEPENDS)
        !           307:        @echo $(COMPILE_MSG) $<
        !           308:        $(QUIET)$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $<
        !           309: 
        !           310: # Implicit MT C Compile Rule
        !           311: $(MTOBJODIR)/%$(OFILE) : %.c $(BUILD_DEPENDS)
        !           312:        @echo $(COMPILE_MSG) $<
        !           313:        $(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) $(MT_CFLAGS) -o $@ -c $<
        !           314: 
        !           315: # Implicit MT C++ Compile Rule
        !           316: $(MTOBJODIR)/%$(OFILE) : %.cpp $(BUILD_DEPENDS)
        !           317:        @echo $(COMPILE_MSG) $<
        !           318:        $(QUIET)$(CXX) $(CFLAGS) $(CXXFLAGS) $(MT_CFLAGS) -o $@ -c $<
        !           319: 
        !           320: depend:
        !           321:        $(QUIET)$(DELETE) $(OBJODIR)/.depend
        !           322:        $(QUIET)$(DELETE) $(MTOBJODIR)/.depend
        !           323:        $(QUIET)$(DELETE) $(LIBODIR)/.depend
        !           324:        $(QUIET)$(DELETE) $(EXEODIR)/.depend
        !           325:        $(QUIET)$(MAKE) BUILD_DEPENDS=FORCE
        !           326: 
        !           327: FORCE:
        !           328: 
        !           329: -include $(MTOBJODIR)/.depend
        !           330: -include $(OBJODIR)/.depend
        !           331: -include $(LIBODIR)/.depend
        !           332: -include $(EXEODIR)/.depend
        !           333: -include $(MTOBJODIR)/*.d
        !           334: -include $(OBJODIR)/*.d
        !           335: -include $(LIBODIR)/*.d
        !           336: -include $(EXEODIR)/*.d
        !           337: 
        !           338: $(XPDEV_LIB): xpdev
        !           339: xpdev:
        !           340:        $(MAKE) -C $(XPDEV_SRC) lib
        !           341: 
        !           342: $(XPDEV-MT_LIB): xpdev-mt
        !           343: xpdev-mt:
        !           344:        $(MAKE) -C $(XPDEV_SRC) mtlib
        !           345: 
        !           346: $(SMBLIB): smblib
        !           347: smblib:
        !           348:        $(MAKE) -C $(SMBLIB_SRC) lib
        !           349: 
        !           350: $(CIOLIB-MT): ciolib-mt
        !           351: ciolib-mt:
        !           352:        $(MAKE) -C $(CIOLIB_SRC) mtlib
        !           353: 
        !           354: $(UIFCLIB): uifc
        !           355: uifc:
        !           356:        $(MAKE) -C $(UIFC_SRC) lib
        !           357: 
        !           358: $(UIFCLIB-MT): uifc-mt
        !           359: uifc-mt:
        !           360:        $(MAKE) -C $(UIFC_SRC) mtlib

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.