2
2
#___________________________________________________________________________
9
CC_SRCS = helloworld.cc
16
# Uncomment for debug-build
16
# Override options (better: specify in environment or on cmdline)
19
27
#___________________________________________________________________________
31
CC := $(if $(CPPBUILD), g++, gcc)
27
35
# Debug build flags
28
CPPFLAGS = -g -D DEBUG
29
ASFLAGS = -f elf -g -dDEBUG
36
CPPFLAGS := -g -D DEBUG $(CPPFLAGS)
37
ASFLAGS := -f elf -g -dDEBUG $(ASFLAGS)
38
LDFLAGS := -Wall $(if $(STATICLIBS), -static) $(LDFLAGS)
34
42
# Release build flags
43
CPPFLAGS := -O2 $(CPPFLAGS)
44
ASFLAGS := -f elf -O2 $(ASFLAGS)
45
LDFLAGS := -Wall -s $(if $(STATICLIBS), -static) $(LDFLAGS)
41
49
# More variables...
43
_SRCS = $(CC_SRCS) $(C_SRCS) $(S_SRCS)
44
_OBJS = $(addsuffix .o,$(basename $(_SRCS)))
45
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
48
59
$(TARGET): $(_OBJS)
49
g++ -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
51
#___________________________________________________________________________
54
.PHONY: all clean run depend dep
56
all: clean depend $(TARGET)
61
$(AR) rcs $(TARGET) $(_OBJS)
63
$(CC) -o $(TARGET) $(LDFLAGS) $(LDLIBS) $(_OBJS)
59
67
rm -f core $(DEPFILE) $(_OBJS)