Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
ef54529a
Commit
ef54529a
authored
20 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Initial outline of common build system (gmake only)
parent
8d1d4894
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/build/Common.gmake
+198
-0
198 additions, 0 deletions
src/build/Common.gmake
with
198 additions
and
0 deletions
src/build/Common.gmake
0 → 100644
+
198
−
0
View file @
ef54529a
#########################################################################
# #
# 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: #
# 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) #
# #
#########################################################################
# Set VERSION
ifndef VERSION
VERSION := 3.12
endif
# 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
else
ifdef DONT_CLOBBER_CC
CC ?= gcc
else
CC := gcc
endif
CCPRE := $(CC)
CXX ?= g++
LD ?= ld
COMPILE_MSG := Compiling
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)$(OBJPATH_SUFFIX)
EXEODIR := $(CCPRE).$(machine).exe.$(BUILDPATH)
LDFLAGS += -L$(LIBODIR)
ifeq ($(os),netbsd)
DELETE := rm -f
else
ifeq ($(os),openbsd)
DELETE := rm -f
else
ifeq ($(os),sunos)
DELETE := rm -f
else
DELETE = rm -fv
endif
endif
endif
LIBPREFIX := lib
DIRSEP := /
OFILE := .o
EXEFILE :=
SOFILE := .so
LIBFILE := .a
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 -I/usr/pkg/pthreads/include -DNEEDS_FORKPTY
endif
ifeq ($(os),darwin)
CFLAGS += -D__unix__ -fno-common -D__DARWIN__
LDFLAGS += -lm
endif
ifdef DEBUG
CFLAGS += -ggdb
CFLAGS += -D_DEBUG
else # RELEASE
CFLAGS := -O3 $(CFLAGS)
endif
-include targets.mk
-include $(SRC_ROOT)/rules.mk
-include objects.mk # defines $(OBJS)
-include libobjs.mk # defines $(LIB_OBJS)
# Implicit C Compile Rule
$(OBJODIR)/%.o : %.c $(BUILD_DEPENDS)
@echo $(COMPILE_MSG) $<
$(QUIET)$(CC) $(CFLAGS) $(CCFLAGS) -o $@ -c $<
# Implicit C++ Compile Rule
$(OBJODIR)/%.o : %.cpp $(BUILD_DEPENDS)
@echo $(COMPILE_MSG) $<
$(QUIET)$(CXX) $(CFLAGS) $(CXXFLAGS) -o $@ -c $<
depend:
$(QUIET)$(DELETE) $(OBJODIR)/.depend
$(QUIET)$(DELETE) $(LIBODIR)/.depend
$(QUIET)$(DELETE) $(EXEODIR)/.depend
$(QUIET)$(MAKE) BUILD_DEPENDS=FORCE
FORCE:
-include $(OBJODIR)/.depend
-include $(LIBODIR)/.depend
-include $(EXEODIR)/.depend
-include $(OBJODIR)/*.d
-include $(LIBODIR)/*.d
-include $(EXEODIR)/*.d
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment