65
# debug/profile build flags
66
64
CPPFLAGS := $(if $(PROFILEMODE),-pg -D PROFILE) $(CPPFLAGS)
67
65
CPPFLAGS := $(if $(DEBUGMODE),-g -D DEBUG -Wall,-O2) $(CPPFLAGS)
68
DFLAGS := $(if $(DEBUGMODE),,-frelease)
66
CPPFLAGS := $(if $(MKSHAREDLIB),-fPIC) $(CPPFLAGS)
69
67
ASFLAGS := -f elf $(if $(DEBUGMODE),-g -dDEBUG,-O2) $(ASFLAGS)
70
68
LDFLAGS := $(if $(PROFILEMODE),-pg) $(LDFLAGS)
71
LDFLAGS := $(if $(or $(PROFILEMODE), $(DEBUGMODE)),,-Wl,-S) $(LDFLAGS)
73
# setup options for shared/static libs
74
CPPFLAGS := $(if $(MKSHAREDLIB),-fPIC) $(CPPFLAGS)
69
LDFLAGS := $(if $(or $(PROFILEMODE),$(DEBUGMODE)),,-Wl,-S) $(LDFLAGS)
75
70
LDFLAGS := $(if $(LINKSTATIC),-static) $(LDFLAGS)
78
LIBRARIES := $(LIBRARIES) $(if $(filter %.d, $(SOURCES)), gphobos pthread m)
80
# build flags for libraries
81
71
LDPOSTFLAGS := $(addprefix -l,$(LIBRARIES)) $(LDPOSTFLAGS)
83
73
#_______________________________________________________________________________
86
76
# object debug/profile suffix
87
77
BUILDSUFFIX := $(if $(PROFILEMODE),_p,$(if $(DEBUGMODE),_d))
89
# work out object and dependency files
90
80
OBJECTS := $(addsuffix $(BUILDSUFFIX).o,$(basename $(SOURCES)))
91
81
DEPFILES := $(addsuffix .dep,$(basename $(SOURCES)))
95
TARGET := $(basename $(TARGET))$(BUILDSUFFIX)$(suffix $(TARGET))
96
TARGET := $(patsubst %.so,%,$(patsubst %.a,%,$(TARGET)))
85
TARGET := $(basename $(TARGET))$(BUILDSUFFIX)$(suffix $(TARGET))
86
TARGET := $(patsubst %.so,%,$(patsubst %.a,%,$(TARGET)))
97
87
ifneq ($(strip $(MKSHAREDLIB) $(MKSTATICLIB)),)
98
TARGET := $(TARGET)$(if $(MKSHAREDLIB),.so,$(if $(MKSTATICLIB),.a))
99
TARGET := lib$(patsubst lib%,%,$(TARGET))
88
TARGET := $(TARGET)$(if $(MKSHAREDLIB),.so,$(if $(MKSTATICLIB),.a))
89
TARGET := lib$(patsubst lib%,%,$(TARGET))