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