forked from sassoftware/cvrpsep
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
88 lines (71 loc) · 2.82 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
###############################################################################
# Matthew Galati - cvrpsep.a - 10/24/03
###############################################################################
# Makefile for Lysgaards CVRPSEP
###############################################################################
#----- UNAME define the shell name
#----- OS define the OS name (short form)
#----- OPTFLAG define the optimization/debug level
#----- COM_TARGETDIR define the directory to compile the objects into
#----- COM_DEPDIR define the directory for the dependency files
#----- COM_LIBSRC define the source files to be compiled
#----- COM_LIBOBJ define the object files to be put in the library
#----- COM_LIBDEP define the dependency files for these object files
#----- TARGET_LIB define the name of the library
#----- CXXFLAGS define the compiler flags (not including include directories)
#----- DEPFLAGS define the dependency flags (mainly for include directories)
#----- CXX define the compile (dependent on OS)
UNAME = $(shell uname)
OS = $(shell uname -s)
OPTFLAG = -O3
#OPTFLAG = -g
COM_TARGETDIR = obj
COM_DEPDIR = dep
COM_LIBSRC = $(filter-out %unitTest.cpp, $(shell /bin/ls *.cpp))
COM_LIBOBJ = $(addprefix $(COM_TARGETDIR)/, $(COM_LIBSRC:.cpp=.o))
COM_LIBDEP = $(addprefix $(COM_DEPDIR)/, $(COM_LIBSRC:.cpp=.d))
TARGET_LIB = libcvrpsep
CXXFLAGS = $(OPTFLAG)
DEPFLAGS += -I. -D$(OS)
LinuxCXX=g++
CXX=$($(OS)CXX)
###############################################################################
# Create the dependency information
$(COM_TARGETDIR)/%.o : %.cpp ${COM_DEPDIR}/%.d Makefile
@echo ""
@if test ! -e ${COM_DEPDIR}/$*.d ; then \
echo ; \
echo " ${COM_DEPDIR}/$*.d is missing."; \
echo " Probably a header file was not found when make examined";\
echo " $*.cpp in an attempt to create that dependency."; \
echo ; \
exit 1; \
fi
@mkdir -p $(COM_TARGETDIR)
$(CXX) $(DEPFLAGS) $(CXXFLAGS) -c $< -o $@
${COM_DEPDIR}/%.d : %.cpp
@echo Creating dependency $*.d
@mkdir -p ${COM_DEPDIR}
@rm -f $*.d $*.dd
g++ -MM $(DEPFLAGS) $< > $*.dd
@sed -e "s|$*.o|$(COM_DEPDIR)/$*.d $(COM_TARGETDIR)/$*.o|g" $*.dd > $@
@rm -f $*.dd
###############################################################################
# Create the targets
.PHONY: default all ${TARGET_LIB} clean
default: ${TARGET_LIB}
all : ${TARGET_LIB}
doc :
${MAKE} -f Makefile.doc doc
clean :
@rm -rf $(COM_DEPDIR)
@rm -rf $(COM_TARGETDIR)
@rm -rf $(UNAME)-*
${TARGET_LIB} : $(COM_TARGETDIR)/${TARGET_LIB}.a
$(COM_TARGETDIR)/${TARGET_LIB}.a: $(COM_LIBOBJ) Makefile
@echo ""
@echo Creating library $(notdir $@)
@mkdir -p $(COM_TARGETDIR)
@rm -f $@
$(AR) -q $@ $(COM_LIBOBJ)
-include $(COM_LIBDEP) $(TESTDEP)