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