2
2
#___________________________________________________________________________
10
C_SRCS = groups.c xmalloc.c
16
# Options (comment-out to disable)
16
# Override options (better: specify in environment or on cmdline)
21
27
#___________________________________________________________________________
31
CC := $(if $(CPPBUILD), g++, gcc)
29
35
# Debug build flags
30
CPPFLAGS = -g -D DEBUG
31
ASFLAGS = -f elf -g -dDEBUG
32
LDFLAGS = -Wall $(if $(STATICLIBS), -static)
36
CPPFLAGS := -g -D DEBUG $(CPPFLAGS)
37
ASFLAGS := -f elf -g -dDEBUG $(ASFLAGS)
38
LDFLAGS := -Wall $(if $(STATICLIBS), -static) $(LDFLAGS)
36
42
# Release build flags
39
LDFLAGS = -Wall -s $(if $(STATICLIBS), -static)
43
CPPFLAGS := -O2 $(CPPFLAGS)
44
ASFLAGS := -f elf -O2 $(ASFLAGS)
45
LDFLAGS := -Wall -s $(if $(STATICLIBS), -static) $(LDFLAGS)
43
49
# More variables...
45
_SRCS = $(CC_SRCS) $(C_SRCS) $(S_SRCS)
46
_OBJS = $(addsuffix .o,$(basename $(_SRCS)))
47
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
50
59
$(TARGET): $(_OBJS)
51
$(if $(CPPBUILD), g++, gcc) -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
53
#___________________________________________________________________________
56
.PHONY: all clean run depend dep
58
all: clean depend $(TARGET)
61
$(AR) rcs $(TARGET) $(_OBJS)
63
$(CC) -o $(TARGET) $(LDFLAGS) $(LDLIBS) $(_OBJS)
61
67
rm -f core $(DEPFILE) $(_OBJS)