2
2
#___________________________________________________________________________
9
CC_SRCS = helloworld.cc
16
# Options (comment-out to disable)
16
# Override options (better: specify in environment or on cmdline)
26
27
#___________________________________________________________________________
31
CC := $(if $(CPPBUILD), g++, gcc)
34
35
# Debug build flags
35
CPPFLAGS := $(CPPFLAGS) -g -D DEBUG
36
ASFLAGS := -f elf -g -dDEBUG
36
CPPFLAGS := -g -D DEBUG $(CPPFLAGS)
37
ASFLAGS := -f elf -g -dDEBUG $(ASFLAGS)
37
38
LDFLAGS := -Wall $(if $(STATICLIBS), -static) $(LDFLAGS)
41
42
# Release build flags
42
CPPFLAGS := $(CPPFLAGS) -O2
43
CPPFLAGS := -O2 $(CPPFLAGS)
44
ASFLAGS := -f elf -O2 $(ASFLAGS)
44
45
LDFLAGS := -Wall -s $(if $(STATICLIBS), -static) $(LDFLAGS)
48
49
# More variables...
50
_SRCS = $(CC_SRCS) $(C_SRCS) $(S_SRCS)
51
_OBJS = $(addsuffix .o,$(basename $(_SRCS)))
52
LDLIBS = $(addprefix -l,$(LIBRARIES))
51
_SRCS := $(CC_SRCS) $(C_SRCS) $(S_SRCS)
52
_OBJS := $(addsuffix .o,$(basename $(_SRCS)))
53
LDLIBS := $(addprefix -l,$(LIBRARIES))
55
.PHONY: all clean run depend dep
55
59
$(TARGET): $(_OBJS)
56
$(if $(CPPBUILD), g++, gcc) -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
58
#___________________________________________________________________________
61
.PHONY: all clean run depend dep
63
all: clean depend $(TARGET)
61
$(AR) rcs $(TARGET) $(_OBJS)
63
$(CC) -o $(TARGET) $(LDFLAGS) $(LDLIBS) $(_OBJS)
66
67
rm -f core $(DEPFILE) $(_OBJS)