33
31
CFLAGS := $(if $(DEBUGMODE),-g -D DEBUG,-O2)
34
32
CXXFLAGS := $(if $(DEBUGMODE),-g -D DEBUG,-O2)
35
33
ASFLAGS := -f elf $(if $(DEBUGMODE),-g -dDEBUG,-O2)
36
34
LDFLAGS := -Wall $(if $(DEBUGMODE),,-s) $(if $(STATICLIBS), -static)
38
#___________________________________________________________________________
36
#_______________________________________________________________________________
40
38
DEPFILE := depends.mk
41
_SRCS := $(CC_SRCS) $(C_SRCS) $(S_SRCS)
42
_OBJS := $(addsuffix .o,$(basename $(_SRCS)))
39
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
43
40
LDLIBS := $(addprefix -l,$(LIBRARIES))
45
.PHONY: all target clean clean_all run depend dep $(SUBDIRS)
47
all: $(SUBDIRS) $(TARGET)
41
TARGET := $(patsubst %.so,%,$(patsubst %.a,%,$(TARGET)))
42
TARGET := $(TARGET)$(if $(BUILDALIB),.a,)$(if $(BUILDSOLIB),.so,)
44
.PHONY: all subdirs target clean clean_all run depend dep $(SUBDIRS)
52
ifeq ($(MAKECMDGOALS),clean)
53
ifeq "$(MAKECMDGOALS)" "clean"
54
@echo NOT RECURSING: Use \"make clean_all\" to clean recursively..."
57
rm -f core $(DEPFILE) $(_OBJS) $(TARGET)
55
@echo NOT RECURSING: Use \"make clean_all\" to clean subdirectoried as well...
58
rm -f core $(DEPFILE) $(OBJECTS) $(TARGET)
60
clean_all: $(SUBDIRS) clean
61
clean_all: subdirs clean
63
$(if $(BUILDLIB),@echo Can\'t run a library\!,./$(TARGET))
66
# makedepend -f- -- $(CPPFLAGS) -- $(_SRCS) > $(DEPFILE)
71
# makedepend -f- -- $(CPPFLAGS) -- $(SOURCES) > $(DEPFILE)
69
74
@$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS)
73
$(AR) rcs $(TARGET) $(_OBJS)
78
$(AR) rcs $(TARGET) $(OBJECTS)
75
$(CC) $(if $(BUILDSO),-shared) -o $(TARGET) $(LDFLAGS) $(_OBJS) $(LDLIBS)
80
$(CXX) $(if $(BUILDSOLIB),-shared) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS)