1
0
Fork 0
mirror of https://gitlab.com/sortix/sortix.git synced 2023-02-13 20:55:38 -05:00

Refactor default compiler options logic.

This commit is contained in:
Jonas 'Sortie' Termansen 2014-04-13 22:34:36 +02:00
parent 12eaf46873
commit 9e6148f6ff
14 changed files with 32 additions and 47 deletions

View file

@ -3,13 +3,8 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
ifndef OPTLEVEL
OPTLEVEL=-g -O2
endif
ifndef CXXFLAGS
CXXFLAGS:=$(OPTLEVEL)
endif
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti

View file

@ -112,3 +112,15 @@ AS:=$(HOSTAS)
LD:=$(HOSTLD)
OBJCOPY:=$(HOSTOBJCOPY)
# Determine default optimization level.
DEFAULT_GENERIC_OPTLEVEL_BASE:=-O2 -g
DEFAULT_BUILD_OPTLEVEL:=$(DEFAULT_GENERIC_OPTLEVEL_BASE)
ifeq ($(BUILD_IS_SORTIX),1)
DEFAULT_BUILD_OPTLEVEL+=
endif
DEFAULT_HOST_OPTLEVEL:=$(DEFAULT_GENERIC_OPTLEVEL_BASE)
DEFAULT_OPTLEVEL:=$(DEFAULT_GENERIC_OPTLEVEL_BASE)
ifeq ($(HOST_IS_SORTIX),1)
DEFAULT_HOST_OPTLEVEL+=
DEFAULT_OPTLEVEL+=
endif

View file

@ -3,13 +3,8 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
ifndef OPTLEVEL
OPTLEVEL:=-g -O2
endif
ifndef CXXFLAGS
CXXFLAGS:=$(OPTLEVEL)
endif
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti
CPPFLAGS:=$(CPPFLAGS) -I include
@ -35,7 +30,7 @@ headers:
client: client/libdispd.a
client/libdispd.a: $(CLIENT_OBJS)
$(HOSTAR) rcs $@ $(CLIENT_OBJS)
$(AR) rcs $@ $(CLIENT_OBJS)
server: server/dispd
@ -48,7 +43,7 @@ clean:
rm -f *.o client/*.o server/*.o
%.o: %.cpp
$(HOSTCXX) -std=gnu++11 -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
$(CXX) -std=gnu++11 -c $< -o $@ $(CPPFLAGS) $(CXXFLAGS)
# Installation into sysroot
install: install-headers install-client install-server

View file

@ -2,7 +2,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
OPTLEVEL?=-g -O2
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CPPFLAGS:=$(CPPFLAGS)

View file

@ -3,13 +3,8 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
ifndef OPTLEVEL
OPTLEVEL=-g -O2
endif
ifndef CXXFLAGS
CXXFLAGS:=$(OPTLEVEL)
endif
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti

View file

@ -4,7 +4,7 @@ include ../version.mak
include ../dirs.mak
# Default values in case the user doesn't override these variables.
OPTLEVEL?=-g -O2
OPTLEVEL?=$(DEFAULT_HOST_OPTLEVEL)
CALLTRACE?=0
DISKWRITE?=1
CPPFLAGS?=

View file

@ -3,9 +3,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
ifndef OPTLEVEL
OPTLEVEL:=-g -O2 -fno-omit-frame-pointer
endif
OPTLEVEL?=$(DEFAULT_HOST_OPTLEVEL)
CPUDIR:=$(CPU)

View file

@ -3,7 +3,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
OPTLEVEL?=-O2 -g
OPTLEVEL?=$(DEFAULT_HOST_OPTLEVEL)
CFLAGS?=$(OPTLEVEL)
# TODO: Better detection of the proper subdirectory here!

View file

@ -3,7 +3,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
OPTLEVEL?=-O2 -g
OPTLEVEL?=$(DEFAULT_HOST_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CPPFLAGS?=

View file

@ -3,7 +3,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
OPTLEVEL?=-g -O2
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti

View file

@ -2,13 +2,8 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
ifndef OPTLEVEL
OPTLEVEL=-g -O2
endif
ifndef CXXFLAGS
CXXFLAGS:=$(OPTLEVEL)
endif
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
SORTIXKERNEL=../kernel

View file

@ -3,7 +3,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
OPTLEVEL?=-O2 -g
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
TESTDIR?=$(LIBEXECDIR)/test

View file

@ -2,7 +2,7 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
OPTLEVEL?=-g -O2
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CPPFLAGS?=
CXXFLAGS?=$(OPTLEVEL)

View file

@ -3,13 +3,8 @@ include ../compiler.mak
include ../version.mak
include ../dirs.mak
ifndef OPTLEVEL
OPTLEVEL=-g -O2
endif
ifndef CXXFLAGS
CXXFLAGS:=$(OPTLEVEL)
endif
OPTLEVEL?=$(DEFAULT_OPTLEVEL)
CXXFLAGS?=$(OPTLEVEL)
CPPFLAGS:=$(CPPFLAGS) -DVERSIONSTR=\"$(VERSION)\"
CXXFLAGS:=$(CXXFLAGS) -Wall -Wextra -fno-exceptions -fno-rtti