1
# Edam's general-purpose makefile v1.10
2
#_______________________________________________________________________________
6
# (better to specify these in environment/command line)
8
#export STATICLIBS := 1
10
# Target binary/library
20
#---------------------------------------------------------------------------
21
# Edam's makefile v1.0
25
SRCS = $(C_SRCS) $(CC_SCRS) $(S_SRCS)
26
OBJS = $(addsuffix .o,$(basename $(SRCS)))
30
$(CC) -o $(TARGET) $(OBJS) $(LDFLAGS)
32
#---------------------------------------------------------------------------
34
.PHONY: all clean depend dep
36
all: clean depend $(TARGET)
21
# Subdirectories to make
31
CFLAGS := $(if $(DEBUGMODE),-g -D DEBUG,-O2)
32
CXXFLAGS := $(if $(DEBUGMODE),-g -D DEBUG,-O2)
33
ASFLAGS := -f elf $(if $(DEBUGMODE),-g -dDEBUG,-O2)
34
LDFLAGS := -Wall $(if $(DEBUGMODE),,-s) $(if $(STATICLIBS), -static)
36
#_______________________________________________________________________________
39
OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
40
LDLIBS := $(addprefix -l,$(LIBRARIES))
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)
39
rm -f core $(DEPFILE) $(OBJS)
53
ifeq "$(MAKECMDGOALS)" "clean"
55
@echo NOT RECURSING: Use \"make clean_all\" to clean subdirectoried as well...
58
rm -f core $(DEPFILE) $(OBJECTS) $(TARGET)
43
makedepend -f- -- $(CFLAGS) -- $(SRCS) > $(DEPFILE)
45
#---------------------------------------------------------------------------
61
clean_all: subdirs clean
71
# makedepend -f- -- $(CPPFLAGS) -- $(SOURCES) > $(DEPFILE)
74
@$(MAKE) --no-print-directory -C $@ $(MAKECMDGOALS)
78
$(AR) rcs $(TARGET) $(OBJECTS)
80
$(CXX) $(if $(BUILDSOLIB),-shared) -o $(TARGET) $(LDFLAGS) $(OBJECTS) $(LDLIBS)
84
# $(CC) -c $(CPPFLAGS) $(CFLAGS)
86
# $(CXX) -c $(CPPFLAGS) $(CXXFLAGS)
92
#_______________________________________________________________________________