Commit 71f3a8d3 authored by rswindell's avatar rswindell
Browse files

Deuce's beautifications and modifications to support OpenBSD.

parent 9bb58bf3
......@@ -14,17 +14,24 @@
# $Id$
# Macros
DEBUG = 1 # Comment out for release (non-debug) version
ifndef DEBUG
ifndef RELEASE
DEBUG := 1
endif
endif
ifdef bcc
CC = bc++ -q
CCPP = bc++ -q
LD = ilink -q
CFLAGS = -D__unix__ -w-csu -w-pch -w-ccc -w-rch -w-par -w-aus
CC = bc++ -q
CCPRE := bcc
CCPP = bc++ -q
LD = ilink -q
CFLAGS += -D__unix__ -w-csu -w-pch -w-ccc -w-rch -w-par -w-aus
else
CC = gcc
CCPP = g++
LD = ld
CFLAGS = -Wall
CC = gcc
CCPRE := gcc
CCPP = g++
LD = ld
CFLAGS += -Wall
endif
SLASH = /
OFILE = o
......@@ -33,69 +40,92 @@ LIBFILE = .a
UIFC = ../uifc/
XPDEV = ../xpdev/
ifndef $(os)
os = $(shell uname)
$(warning OS not specified on command line, setting to '$(os)'.)
ifndef os
os := $(shell uname)
$(warning OS not specified on command line, setting to '$(os)'.)
endif
os := $(shell echo $(os) | awk '/.*/ { print tolower($$1)}')
ifeq ($(os),FreeBSD) # FreeBSD
LIBODIR := gcc.freebsd.lib
EXEODIR := gcc.freebsd.exe
else # Linux
ifdef bcc
LIBODIR := bcc.linux.lib
EXEODIR := bcc.linux.exe
ifeq ($(os),freebsd)
BSD = 1
else
# -O doesn't work on FreeBSD (possible conflict with -g)
# CFLAGS += -O
LIBODIR := gcc.linux.lib
EXEODIR := gcc.linux.exe
endif
ifeq ($(os),openbsd)
BSD = 1
endif
endif
DELETE = rm -fv
LIBODIR := $(CCPRE).$(os).lib
EXEODIR := $(CCPRE).$(os).exe
DELETE = rm -f
CFLAGS += -DJAVASCRIPT -I../mozilla/js/src -I$(XPDEV) -I$(UIFC)
ifeq ($(os),FreeBSD) # FreeBSD
CFLAGS += -D_THREAD_SAFE
# Math libraries needed and uses pthread
LFLAGS := -lm -pthread -lutil
ifdef BSD # BSD
CFLAGS += -D_THREAD_SAFE
# Math libraries needed and uses pthread
LFLAGS := -lm -pthread -lutil
else # Linux / Other UNIX
# Math and pthread libraries needed
ifdef bcc
LFLAGS := libpthread.so
else
LFLAGS := -lm -lpthread -lutil
endif
# Math and pthread libraries needed
ifdef bcc
LFLAGS := libpthread.so
else
LFLAGS := -lm -lpthread -lutil
endif
endif
ifeq ($(os),Linux) # Linux
CFLAGS += -D_THREAD_SUID_BROKEN
ifeq ($(os),linux) # Linux
CFLAGS += -D_THREAD_SUID_BROKEN
endif
ifdef DEBUG
ifdef bcc
CFLAGS += -y -v -Od
else
CFLAGS += -g
endif
CFLAGS += -D_DEBUG
LIBODIR := $(LIBODIR).debug
EXEODIR := $(EXEODIR).debug
ifeq ($(os),FreeBSD) # FreeBSD
LIBS += ../mozilla/js/src/FreeBSD4.3-RELEASE_DBG.OBJ/libjs.a
else # Linux
LIBS += ../mozilla/js/src/Linux_All_DBG.OBJ/libjs.a
endif
ifdef bcc
CFLAGS += -y -v -Od
else
CFLAGS += -ggdb
endif
CFLAGS += -D_DEBUG
LIBODIR := $(LIBODIR).debug
EXEODIR := $(EXEODIR).debug
ifdef JSLIB
LIBS += $(JSLIB)
else
ifeq ($(os),freebsd)
LIBS += ../mozilla/js/src/FreeBSD4.3-RELEASE_DBG.OBJ/libjs.a
else
ifeq ($(os),openbsd)
LIBS += ../mozilla/js/src/OpenBSD3.1_DBG.OBJ/libjs.a
else
ifeq ($(os),linux)
LIBS += ../mozilla/js/src/Linux_All_DBG.OBJ/libjs.a
else
$(warning JavaScript library path for '$(os)' not defined.)
endif
endif
endif
endif
else # RELEASE
LIBODIR := $(LIBODIR).release
EXEODIR := $(EXEODIR).release
ifeq ($(os),FreeBSD) # FreeBSD
LIBS += ../mozilla/js/src/FreeBSD4.3-RELEASE_OPT.OBJ/libjs.a
else
LIBS += ../mozilla/js/src/Linux_All_OPT.OBJ/libjs.a
endif
LIBODIR := $(LIBODIR).release
EXEODIR := $(EXEODIR).release
ifdef JSLIB
LIBS += $(JSLIB)
else
ifeq ($(os),freebsd)
LIBS += ../mozilla/js/src/FreeBSD4.3-RELEASE_OPT.OBJ/libjs.a
else
ifeq ($(os),openbsd)
LIBS += ../mozilla/js/src/OpenBSD3.1_OPT.OBJ/libjs.a
else
ifeq ($(os),linux)
LIBS += ../mozilla/js/src/Linux_All_OPT.OBJ/libjs.a
else
$(warning JavaScript library path for '$(os)' not defined.)
endif
endif
endif
endif
endif
include targets.mk # defines all targets
......@@ -109,23 +139,23 @@ vpath %.c $(XPDEV) $(UIFC)
# Implicit C Compile Rule for utils
$(EXEODIR)/%.o : %.c
ifndef bcc
ifndef bcc
@echo Compiling $<
endif
endif
@$(CC) $(CFLAGS) -o $@ -c $<
# Implicit C Compile Rule for SBBS
$(LIBODIR)/%.o : %.c
ifndef bcc
ifndef bcc
@echo Compiling $<
endif
endif
@$(CC) $(CFLAGS) $(SBBSDEFS) -o $@ -c $<
# Implicit C++ Compile Rule for SBBS
$(LIBODIR)/%.o : %.cpp
ifndef bcc
ifndef bcc
@echo Compiling $<
endif
endif
@$(CCPP) $(CFLAGS) $(SBBSDEFS) -o $@ -c $<
# Create output directories
......@@ -165,7 +195,7 @@ $(MAILSRVR): $(MAIL_OBJS) $(SBBSLIB)
# Synchronet Console Build Rule
$(SBBSCON): $(CON_OBJS) $(SBBSLIB)
$(CC) $(CFLAGS) -o $@ $^
@$(CC) $(CFLAGS) -o $@ $^
# Specifc Compile Rules
$(LIBODIR)/ftpsrvr.o: ftpsrvr.c ftpsrvr.h
......
......@@ -14,7 +14,12 @@
# $Id$
# Macros
DEBUG = 1 # Comment out for release (non-debug) version
ifndef DEBUG
ifndef RELEASE
DEBUG := 1
endif
endif
#USE_DIALOG = 1 # Dialog vesrion of UIFC
USE_CURSES = 1 # Curses version of UIFC
CC = gcc
......@@ -23,44 +28,40 @@ OFILE = o
UIFC = ../../uifc
XPDEV = ../../xpdev
ifndef $(os)
os = $(shell uname)
$(warning OS not specified on command line, setting to '$(os)'.)
ifndef os
os = $(shell uname)
$(warning OS not specified on command line, setting to '$(os)'.)
endif
os := $(shell echo $(os) | awk '/.*/ { print tolower($$1)}')
ifeq ($(os),FreeBSD) # FreeBSD
ODIR := gcc.freebsd
else # Linux
ODIR := gcc.linux
endif
ODIR := gcc.$(os)
LIBDIR := /usr/lib
DELETE = rm -f -v
OUTLIB = -o
CFLAGS := -Wall -I$(UIFC) -I$(XPDEV) -I/usr/local/include -I../ -D_THREAD_SAFE
CFLAGS += -Wall -I$(UIFC) -I$(XPDEV) -I/usr/local/include -I../ -D_THREAD_SAFE
LFLAGS := -L/usr/local/lib
ifdef USE_DIALOG
LFLAGS := $(LFLAGS) -L../../libdialog -ldialog -lcurses
CFLAGS := $(CFLAGS) -I../../libdialog -DUSE_DIALOG
LFLAGS := $(LFLAGS) -L../../libdialog -ldialog -lcurses
CFLAGS += -I../../libdialog -DUSE_DIALOG
endif
ifdef USE_CURSES
LFLAGS := $(LFLAGS) -lcurses
CFLAGS := $(CFLAGS) -DUSE_CURSES
LFLAGS := $(LFLAGS) -lcurses
CFLAGS += -DUSE_CURSES
endif
# Math library needed
LFLAGS := $(LFLAGS) -lm
ifdef DEBUG
CFLAGS := $(CFLAGS) -g -O0 -D_DEBUG
ODIR := $(ODIR).debug
CFLAGS += -ggdb -O0 -D_DEBUG
ODIR := $(ODIR).debug
else # RELEASE
LFLAGS := $(LFLAGS)
ODIR := $(ODIR).release
ODIR := $(ODIR).release
endif
include targets.mk # defines all targets
......@@ -68,11 +69,11 @@ include objects.mk # defines $(OBJS)
include headers.mk # defines $(HEADERS)
ifdef USE_DIALOG
OBJS := $(OBJS) $(ODIR)$(SLASH)uifcd.$(OFILE)
OBJS := $(OBJS) $(ODIR)$(SLASH)uifcd.$(OFILE)
endif
ifdef USE_CURSES
OBJS := $(OBJS) $(ODIR)$(SLASH)uifcc.$(OFILE)
OBJS := $(OBJS) $(ODIR)$(SLASH)uifcc.$(OFILE)
endif
vpath %.c ..
......@@ -96,9 +97,9 @@ $(SCFGHELP): $(OBJS) makehelp
# Monolithic Synchronet executable Build Rule
$(SCFG): $(OBJS)
ifdef USE_DIALOG
ifdef USE_DIALOG
@$(MAKE) --no-print-directory -C ../../libdialog
endif
endif
@echo Linking $@
@$(CC) -o $@ $(OBJS) $(LFLAGS)
......
......@@ -13,51 +13,65 @@
# $Id$
# Macros
DEBUG = 1 # Comment out for release (non-debug) version
ifndef DEBUG
ifndef RELEASE
DEBUG := 1
endif
endif
ifdef bcc
CC = bc++
CFLAGS = -q -w -D__unix__
CC := bc++
CCPRE := bcc
CFLAGS += -q -w -D__unix__
else
CC = gcc
CFLAGS = -Wall -O
CC := gcc
CCPRE := gcc
CFLAGS += -Wall -O
endif
SLASH = /
OFILE = o
ifndef $(os)
os = $(shell uname)
$(warning OS not specified on command line, setting to '$(os)'.)
ifndef os
os = $(shell uname)
$(warning OS not specified on command line, setting to '$(os)'.)
endif
os := $(shell echo $(os) | awk '/.*/ { print tolower($$1)}')
ifdef bcc
ODIR := bcc.$(os)
ODIR := bcc.$(os)
else
ODIR := gcc.$(os)
ODIR := gcc.$(os)
endif
DELETE = rm -fv
ifeq ($(os),FreeBSD) # FreeBSD
CFLAGS += -D_THREAD_SAFE
LFLAGS := -pthread
else # Linux / Other UNIX
ifdef bcc
LFLAGS := libpthread.a
ifeq ($(os),freebsd) # FreeBSD
CFLAGS += -D_THREAD_SAFE
LFLAGS := -pthread
else
LFLAGS := -lpthread
endif
endif
ifeq ($(os),openbsd) # OpenBSD
CFLAGS += -D_THREAD_SAFE
LFLAGS := -pthread
else # Linux / Other UNIX
ifdef bcc
LFLAGS := libpthread.a
else
LFLAGS := -lpthread
endif !bcc
endif !OpenBSD
endif !FreeBSD
ifdef DEBUG
ifdef bcc
CFLAGS += -v -y
else
CFLAGS += -g
endif
CFLAGS += -D_DEBUG
ODIR := $(ODIR).debug
ifdef bcc
CFLAGS += -v -y
else
CFLAGS += -g
endif
CFLAGS += -D_DEBUG
ODIR := $(ODIR).debug
else # RELEASE
ODIR := $(ODIR).release
ODIR := $(ODIR).release
endif
include objects.mk # defines $(OBJS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment