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