Show cursor on exit
[utui.git] / Makefile
blob28f088a4cfa9c74dfb1fa8a8ec3d3e4e68e12852
1 include Config.mk
3 ################ Source files ########################################
5 CDIRS = ctrl
6 SRCS = $(wildcard *.cc) $(foreach dir, ${CDIRS}, $(wildcard $(dir)/*.cc))
7 INCS = $(filter-out bsconf.h, $(wildcard *.h)) $(foreach dir, ${CDIRS}, $(wildcard $(dir)/*.h))
8 OBJS = $(SRCS:.cc=.o)
9 DOCT = utuidoc.in
11 ################ Library link names ##################################
13 LIBA = lib${LIBNAME}.a
14 LIBSO = lib${LIBNAME}.so
15 ifdef MAJOR
16 LIBSOLNK= ${LIBSO}.${MAJOR}
17 LIBSOBLD= ${LIBSO}.${MAJOR}.${MINOR}.${BUILD}
18 endif
19 TOCLEAN += ${LIBSO} ${LIBA} ${LIBSOBLD}
21 ALLINST = install-incs
22 ifdef BUILD_SHARED
23 ALLLIBS += ${LIBSOBLD}
24 ALLINST += install-shared
25 endif
26 ifdef BUILD_STATIC
27 ALLLIBS += ${LIBA}
28 ALLINST += install-static
29 endif
31 ################ Compilation #########################################
33 .PHONY: all install uninstall install-incs uninstall-incs
34 .PHONY: install-static install-shared uninstall-static uninstall-shared
35 .PHONY: clean depend html check dist distclean maintainer-clean
37 all: ${ALLLIBS}
39 %.o: %.cc
40 @echo " Compiling $< ..."
41 @${CXX} ${CXXFLAGS} -o $@ -c $<
43 %.s: %.cc
44 @echo " Compiling $< to assembly ..."
45 @${CXX} ${CXXFLAGS} -S -g0 -Os -DNDEBUG=1 -fomit-frame-pointer -o $@ -c $<
47 html:
48 @${DOXYGEN} ${DOCT}
50 ################ Installation ########################################
52 install: ${ALLINST}
53 uninstall: $(subst install,uninstall,${ALLINST})
55 ${LIBA}: ${OBJS}
56 @echo "Linking $@ ..."
57 @${AR} r $@ $?
58 @${RANLIB} $@
60 ${LIBSOBLD}: ${OBJS}
61 @echo "Linking $@ ..."
62 @${LD} ${LDFLAGS} ${SHBLDFL} -o $@ $^ ${LIBS}
64 install-shared: ${LIBSOBLD}
65 @echo "Installing ${LIBSOBLD} to ${LIBDIR} ..."
66 @${INSTALLDIR} ${LIBDIR}
67 @${INSTALLLIB} ${LIBSOBLD} ${LIBDIR}
68 @(cd ${LIBDIR}; ln -sf ${LIBSOBLD} ${LIBSO}; ln -sf ${LIBSOBLD} ${LIBSOLNK})
70 uninstall-shared:
71 @echo "Removing ${LIBSOBLD} from ${LIBDIR} ..."
72 @rm -f ${LIBDIR}/${LIBSO} ${LIBDIR}/${LIBSOLNK} ${LIBDIR}/${LIBSOBLD}
74 install-static: ${LIBA}
75 @echo "Installing ${LIBA} to ${LIBDIR} ..."
76 @${INSTALLDIR} ${LIBDIR}
77 @${INSTALLLIB} ${LIBA} ${LIBDIR}
79 uninstall-static:
80 @echo "Removing ${LIBA} from ${LIBDIR} ..."
81 @rm -f ${LIBDIR}/${LIBA}
83 install-incs: ${INCS}
84 @echo "Installing headers to ${INCDIR} ..."
85 @${INSTALLDIR} ${INCDIR}/${LIBNAME}
86 @for i in $(filter-out ${LIBNAME}.h, ${INCS}); do \
87 ${INSTALLDIR} `dirname ${INCDIR}/${LIBNAME}/$$i`; \
88 ${INSTALLDATA} $$i ${INCDIR}/${LIBNAME}/$$i; \
89 done;
90 @${INSTALLDATA} ${LIBNAME}.h ${INCDIR}
92 uninstall-incs:
93 @echo "Removing headers from ${INCDIR} ..."
94 @rm -rf ${INCDIR}/${LIBNAME} ${INCDIR}/${LIBNAME}.h
96 ################ Maintenance ###########################################
98 clean:
99 @echo "Removing generated files ..."
100 @rm -f ${OBJS} ${TOCLEAN}
102 depend: ${SRCS}
103 @rm -f .depend
104 @for i in ${SRCS}; do \
105 ${CXX} ${CXXFLAGS} -M -MT $${i%%.cc}.o $$i >> .depend; \
106 done
108 TMPDIR = /tmp
109 DISTDIR = ${HOME}/stored
110 DISTNAM = ${LIBNAME}-${MAJOR}.${MINOR}
111 DISTTAR = ${DISTNAM}.${BUILD}.tar.bz2
113 dist:
114 mkdir ${TMPDIR}/${DISTNAM}
115 cp -r . ${TMPDIR}/${DISTNAM}
116 +make -C ${TMPDIR}/${DISTNAM} html distclean
117 (cd ${TMPDIR}/${DISTNAM}; rm -rf `find . -name .svn`)
118 (cd ${TMPDIR}; tar jcf ${DISTDIR}/${DISTTAR} ${DISTNAM}; rm -rf ${DISTNAM})
120 distclean: clean
121 @rm -f Config.mk config.h bsconf.o bsconf .depend
123 maintainer-clean: distclean
124 @rm -rf docs/html
126 -include .depend