Fixed the terminal not fully functional error
[utio.git] / Makefile
blob6896a47bb9540808fefab57efde35085df1cbdb7
1 include Config.mk
3 ################ Source files ##########################################
5 SRCS = $(wildcard *.cc)
6 OBJS = $(SRCS:.cc=.o)
7 INCS = $(filter-out bsconf.%,$(wildcard *.h))
8 DOCT = utiodoc.in
10 ################ Library link names ####################################
12 TOCLEAN += ${LIBSO} ${LIBA} ${LIBSOBLD}
14 ALLINST = install-incs
15 ifdef BUILD_SHARED
16 ALLLIBS += ${LIBSOBLD}
17 ALLINST += install-shared
18 endif
19 ifdef BUILD_STATIC
20 ALLLIBS += ${LIBA}
21 ALLINST += install-static
22 endif
24 ################ Compilation ###########################################
26 .PHONY: all html
28 all: ${ALLLIBS}
30 ${LIBA}: ${OBJS}
31 @echo "Linking $@ ..."
32 @${AR} r $@ $?
33 @${RANLIB} $@
35 ${LIBSOBLD}: ${OBJS}
36 @echo "Linking $@ ..."
37 @${LD} ${LDFLAGS} ${SHBLDFL} -o $@ $^ ${LIBS}
39 %.o: %.cc
40 @echo " Compiling $< ..."
41 @${CXX} ${CXXFLAGS} -o $@ -c $<
43 %.s: %.cc
44 @echo " Compiling $< to assembly ..."
45 @${CXX} ${CXXFLAGS} -S -o $@ -c $<
47 html:
48 @${DOXYGEN} ${DOCT}
50 ################ Installation ##########################################
52 .PHONY: install uninstall install-incs uninstall-incs
53 .PHONY: install-static install-shared uninstall-static uninstall-shared
55 install: ${ALLINST}
56 uninstall: $(subst install,uninstall,${ALLINST})
58 INSTALLDIR = ${INSTALL} -d
59 INSTALLLIB = ${INSTALL} -p -m 644
60 INSTALLEXE = ${INSTALL} -p -m 755
61 INSTALLDATA = ${INSTALL} -p -m 644
63 install-shared: ${LIBSOBLD} install-incs
64 @echo "Installing ${LIBSOBLD} to ${LIBDIR} ..."
65 @${INSTALLDIR} ${LIBDIR}
66 @${INSTALLLIB} ${LIBSOBLD} ${LIBDIR}
67 @(cd ${LIBDIR}; ${LN} -sf ${LIBSOBLD} ${LIBSO}; ${LN} -sf ${LIBSOBLD} ${LIBSOLNK})
69 uninstall-shared: uninstall-incs
70 @echo "Removing ${LIBSOBLD} from ${LIBDIR} ..."
71 @${RM} -f ${LIBDIR}/${LIBSO} ${LIBDIR}/${LIBSOLNK} ${LIBDIR}/${LIBSOBLD}
73 install-static: ${LIBA} install-incs
74 @echo "Installing ${LIBA} to ${LIBDIR} ..."
75 @${INSTALLDIR} ${LIBDIR}
76 @${INSTALLLIB} ${LIBA} ${LIBDIR}
78 uninstall-static: uninstall-incs
79 @echo "Removing ${LIBA} from ${LIBDIR} ..."
80 @${RM} -f ${LIBDIR}/${LIBA}
82 install-incs: ${INCS}
83 @echo "Installing headers to ${INCDIR} ..."
84 @${INSTALLDIR} ${INCDIR}/${LIBNAME}
85 @for i in $(filter-out ${LIBNAME}.h,${INCS}); do \
86 ${INSTALLDATA} $$i ${INCDIR}/${LIBNAME}/$$i; \
87 done;
88 @${INSTALLDATA} ${LIBNAME}.h ${INCDIR}
90 uninstall-incs:
91 @echo "Removing headers from ${INCDIR} ..."
92 @${RM} -rf ${INCDIR}/${LIBNAME} ${INCDIR}/${LIBNAME}.h
94 ################ Maintenance ###########################################
96 .PHONY: clean depend dist distclean maintainer-clean
98 clean:
99 @echo "Removing generated files ..."
100 @${RM} -f ${OBJS} ${TOCLEAN}
101 @+${MAKE} -C demo clean
103 depend: ${SRCS}
104 @${CXX} ${CXXFLAGS} -M ${SRCS} > .depend;
106 TMPDIR = /tmp
107 DISTDIR = ${HOME}/stored
108 DISTNAM = ${LIBNAME}-${MAJOR}.${MINOR}
109 DISTTAR = ${DISTNAM}.${BUILD}.tar.bz2
111 dist:
112 mkdir ${TMPDIR}/${DISTNAM}
113 cp -r . ${TMPDIR}/${DISTNAM}
114 +${MAKE} -C ${TMPDIR}/${DISTNAM} distclean
115 (cd ${TMPDIR}/${DISTNAM}; rm -rf `find . -name .svn`)
116 (cd ${TMPDIR}; tar jcf ${DISTDIR}/${DISTTAR} ${DISTNAM}; rm -rf ${DISTNAM})
118 distclean: clean
119 @rm -f Config.mk config.h ${LIBNAME}.spec bsconf.o bsconf .depend demo/.depend
121 maintainer-clean: distclean
122 @rm -rf docs/html
124 -include .depend