|
|
3.12a Javascript
# build/Common.gmake
#
# Global build system setup file
#
# $Id: common.gmake,v 1.1.1.1 2018/04/24 16:39:44 root Exp $
#
#############################################################################
# @format.tab-size 4 (Plain Text/Source Code File Header) #
# @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) #
# #
# Copyright 2004 Rob Swindell - http://www.synchro.net/copyright.html #
# #
# This program is free software; you can redistribute it and/or #
# modify it under the terms of the GNU General Public License #
# as published by the Free Software Foundation; either version 2 #
# of the License, or (at your option) any later version. #
# See the GNU General Public License for more details: gpl.txt or #
# http://www.fsf.org/copyleft/gpl.html #
# #
# Anonymous FTP access to the most recent released source is available at #
# ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net #
# #
# Anonymous CVS access to the development source and modification history #
# is available at cvs.synchro.net:/cvsroot/sbbs, example: #
# cvs -d :pserver:[email protected]:/cvsroot/sbbs login #
# (just hit return, no password is necessary) #
# cvs -d :pserver:[email protected]:/cvsroot/sbbs checkout src #
# #
# For Synchronet coding style and modification guidelines, see #
# http://www.synchro.net/source.html #
# #
# You are encouraged to submit any modifications (preferably in Unix diff #
# format) via e-mail to [email protected] #
# #
# Note: If this box doesn't appear square, then you need to fix your tabs. #
#############################################################################
# #
#############################################################################
# #
# Common macro setup for GNU make #
# #
# Common Build Macros REQUIRED: #
# SRC_ROOT - *MUST* be set to the src dir #
# #
# Common Build Macros Used: #
# DEBUG - Create a debug build #
# RELEASE - Create a release build #
# (Mutually exclusive, if both are set, RELEASE #
# is cleared) #
# DONT_CLOBBER_CC - Do not change the default setting of CC #
# OBJPATH_SUFFIX - Suffix appended to OBJPATH usefull for compiling #
# different options of the same source file #
# #
# Common Build Macros Defined: #
# DELETE - Delete files (Preferrably verbose) #
# MTOBJODIR - Object output dir #
# OBJODIR - Object output dir #
# LIBODIR - Library output dir #
# EXEODIR - Executable output dir #
# DEBUG - Set for debug builds #
# RELEASE - Set for release builds #
# One of DEBUG or RELEASE is always set! #
# QUIET - Target command prefix to show/not show commands #
# (Toggled off by setting VERBOSE) #
# CFLAGS - Common C and C++ compiler flags #
# CCFLAGS - C specific compiler flags #
# CXXFLAGS - C++ specific compiler flags #
# LDFLAGS - Linker flags #
# CC - C compiler #
# CXX - C++ compiler #
# EXEFILE - Executable file extension (Includes .) #
# OFILE - Object file extension (Includes .) #
# SOFILE - Shared object (DLL) file extension (Includes .) #
# LIBFILE - Static library file extension (Include .) #
# LIBPREFIX - Prefix to library filename #
# LIBS - Library names (Appropriate for dependencies) #
# LIB_LDFLAGS - Libraries appropriate for link command-line usage #
# COMPILE_MSG - Message saying a target is being compiled #
# DIRSEP - The directory seperator this system likes most #
# VERSION - Synchronet version number in MAJOR.MINOR format #
# (Numeric ONLY) #
# OUTPUT - Compiler flag specifying output filename #
# LOUTPUT - Linker flag specifying output filename #
# XPDEV_SRC - Path to xpdev #
# UIFC_SRC - Path to uifc #
# CIOLIB_SRC - Path to ciolib #
# SMBLIB_SRC - Path to smblib #
# MT_CFLAGS - CFLAGS for building MT objects #
# MT_LDFLAGS - LDFLAGS for linking MT targets #
# UL_PRE - Use Library prefix (*nix is -l) #
# UL_SUF - Use Library siffix (bcc is .lib) #
# #
# Common Targets Defined: #
# Implicit C and C++ targets #
# "clean" target #
# Output directory targets #
# #
#############################################################################
# Set VERSION
ifndef VERSION
VERSION := 3.12
endif
# Put local (optional) macro definitions in localdefs.mk
-include localdefs.mk
-include $(SRC_ROOT)/build/localdefs.mk
# Set DEBUG
ifdef DEBUG
ifdef RELEASE
undef RELEASE
endif
endif
ifndef DEBUG
ifndef RELEASE
DEBUG := 1
endif
endif
# VERBOSE/QUIET
ifndef VERBOSE
QUIET := @
endif
# Compiler-specific options
CFLAGS += -MMD
ifdef BUILD_DEPENDS
ifdef DONT_CLOBBER_CC
CC ?= gcc
else
CC := gcc
endif
CCPRE := $(CC)
CC := $(SRC_ROOT)/build/mkdep -a
CXX := $(SRC_ROOT)/build/mkdep -a
LD := echo
COMPILE_MSG := Depending
AR := echo
RANLIB := echo
else
ifdef DONT_CLOBBER_CC
CC ?= gcc
else
CC := gcc
endif
CCPRE := $(CC)
CXX ?= g++
LD ?= ld
COMPILE_MSG := Compiling
AR ?= ar
RANLIB ?= ranlib
endif
ifdef DEBUG
BUILD = debug
else
BUILD = release
endif
BUILDPATH ?= $(BUILD)
# Get OS
ifndef os
os := $(shell uname)
endif
os := $(shell echo $(os) | tr '[A-Z]' '[a-z]' | tr ' ' '_')
machine := $(shell if uname -m | egrep -v "(i[3456789]|x)86" > /dev/null; then uname -m | tr "[A-Z]" "[a-z]" | tr " " "_" ; fi)
ifeq ($(machine),sun4u)
CFLAGS += -D__BIG_ENDIAN__
endif
ifeq ($(machine),)
machine := $(os)
else
machine := $(os).$(machine)
endif
LIBODIR := $(CCPRE).$(machine).lib.$(BUILDPATH)
OBJODIR := $(CCPRE).$(machine).obj.$(BUILDPATH)
MTOBJODIR := $(CCPRE).$(machine).obj.$(BUILDPATH)-mt
EXEODIR := $(CCPRE).$(machine).exe.$(BUILDPATH)
LDFLAGS += -L$(LIBODIR)
ifeq ($(os),openbsd)
DELETE := rm -f
else
ifeq ($(os),sunos)
DELETE := rm -f
else
DELETE = rm -fv
endif
endif
LIBPREFIX := lib
DIRSEP := /
OFILE := .o
EXEFILE :=
SOFILE := .so
LIBFILE := .a
UL_PRE := -l
UL_SUF :=
OUTPUT := -o
LOUTPUT := -o
ifeq ($(os),openbsd)
SOFILE := $(SOFILE).$(VERSION)
else
ifeq ($(os),darwin)
SOFILE = .dylib
endif
endif
# OS Specific Flags
ifeq ($(os),sunos) # Solaris
CFLAGS += -D__solaris__ -DNEEDS_DAEMON -DNEEDS_FORKPTY -DNEEDS_SETENV -DNEEDS_CFMAKERAW
endif
ifeq ($(os),netbsd) # NetBSD
CFLAGS += -D__unix__ -I/usr/pkg/include
endif
ifeq ($(os),darwin)
CFLAGS += -D__unix__ -fno-common -D__DARWIN__
LDFLAGS += -lm
endif
# PThread-specific flags
ifeq ($(os),linux) # Linux
ifndef THREADS_ACTUALLY_WORK
CFLAGS += -D_THREAD_SUID_BROKEN
endif
endif
MT_CFLAGS += -D_THREAD_SAFE -D_REENTRANT
ifeq ($(os),freebsd) # FreeBSD
MT_CFLAGS += -DUSE_XP_SEMAPHORES
MT_LDFLAGS += -pthread
XP_SEM := 1
else
ifeq ($(os),openbsd) # OpenBSD
MT_CFLAGS += -DUSE_XP_SEMAPHORES
MT_LDFLAGS += -pthread
XP_SEM := 1
else
ifeq ($(os),netbsd) # NetBSD
MT_CFLAGS += -DUSE_XP_SEMAPHORES
MT_LDFLAGS += -L/usr/pkg/lib -lpthread
XP_SEM := 1
else
ifeq ($(os),qnx) # QNX
else
ifeq ($(os),darwin) # Darwin/Mac OS X
CFLAGS += -D__unix__
MT_CFLAGS += -DUSE_XP_SEMAPHORES -D__DARWIN__
MT_LDFLAGS += -lpthread
XP_SEM := 1
else
ifeq ($(os),sunos) # Solaris
XP_SEM := 1
MT_CFLAGS += -D_POSIX_PTHREAD_SEMANTICS
MT_CFLAGS += -DUSE_XP_SEMAPHORES
MT_LDFLAGS += -lpthread
else # Linux / Other UNIX
XP_SEM := 1
MT_CFLAGS += -DUSE_XP_SEMAPHORES
MT_LDFLAGS += -lpthread
endif
endif
endif
endif
endif
endif
# Paths
XPDEV_SRC := $(SRC_ROOT)$(DIRSEP)xpdev
CIOLIB_SRC := $(SRC_ROOT)$(DIRSEP)conio
SMBLIB_SRC := $(SRC_ROOT)$(DIRSEP)smblib
UIFC_SRC := $(SRC_ROOT)$(DIRSEP)uifc
# Pull in lib-specific flags
include $(CIOLIB_SRC)$(DIRSEP)Common.make
include $(UIFC_SRC)$(DIRSEP)Common.make
include $(SMBLIB_SRC)$(DIRSEP)Common.make
include $(XPDEV_SRC)$(DIRSEP)Common.make
-include $(CIOLIB_SRC)$(DIRSEP)Common.gmake
-include $(UIFC_SRC)$(DIRSEP)Common.gmake
-include $(SMBLIB_SRC)$(DIRSEP)Common.gmake
-include $(XPDEV_SRC)$(DIRSEP)Common.gmake
ifdef DEBUG
CFLAGS += -ggdb
CFLAGS += -D_DEBUG
else # RELEASE
CFLAGS := -O3 $(CFLAGS)
endif
-include targets.mk
-include $(SRC_ROOT)/build/rules.mk
-include objects.mk # defines $(OBJS)
# Implicit C Compile Rule
$(OBJODIR)/%$(OFILE) : %.c $(BUILD_DEPENDS)
@echo $(COMPILE_MSG) $<
$(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) -o $@ -c $<
# Implicit C++ Compile Rule
$(OBJODIR)/%$(OFILE) : %.cpp $(BUILD_DEPENDS)
@echo $(COMPILE_MSG) $<
$(QUIET)$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $<
# Implicit MT C Compile Rule
$(MTOBJODIR)/%$(OFILE) : %.c $(BUILD_DEPENDS)
@echo $(COMPILE_MSG) $<
$(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) $(MT_CFLAGS) -o $@ -c $<
# Implicit MT C++ Compile Rule
$(MTOBJODIR)/%$(OFILE) : %.cpp $(BUILD_DEPENDS)
@echo $(COMPILE_MSG) $<
$(QUIET)$(CXX) $(CFLAGS) $(CXXFLAGS) $(MT_CFLAGS) -o $@ -c $<
depend:
$(QUIET)$(DELETE) $(OBJODIR)/.depend
$(QUIET)$(DELETE) $(MTOBJODIR)/.depend
$(QUIET)$(DELETE) $(LIBODIR)/.depend
$(QUIET)$(DELETE) $(EXEODIR)/.depend
$(QUIET)$(MAKE) BUILD_DEPENDS=FORCE
FORCE:
-include $(MTOBJODIR)/.depend
-include $(OBJODIR)/.depend
-include $(LIBODIR)/.depend
-include $(EXEODIR)/.depend
-include $(MTOBJODIR)/*.d
-include $(OBJODIR)/*.d
-include $(LIBODIR)/*.d
-include $(EXEODIR)/*.d
$(XPDEV_LIB): xpdev
xpdev:
$(MAKE) -C $(XPDEV_SRC) lib
$(XPDEV-MT_LIB): xpdev-mt
xpdev-mt:
$(MAKE) -C $(XPDEV_SRC) mtlib
$(SMBLIB): smblib
smblib:
$(MAKE) -C $(SMBLIB_SRC) lib
$(CIOLIB-MT): ciolib-mt
ciolib-mt:
$(MAKE) -C $(CIOLIB_SRC) mtlib
$(UIFCLIB): uifc
uifc:
$(MAKE) -C $(UIFC_SRC) lib
$(UIFCLIB-MT): uifc-mt
uifc-mt:
$(MAKE) -C $(UIFC_SRC) mtlib
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.