diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 85 |
1 files changed, 43 insertions, 42 deletions
@@ -1,60 +1,61 @@ # st - simple terminal # See LICENSE file for copyright and license details. -include config.mk +# st version +VERSION = 0.3 -SRC = st.c term.c -OBJ = ${SRC:.c=.o} +PREFIX = /usr/local +MANPREFIX = ${PREFIX}/share/man +X11INC = /usr/X11R6/include +X11LIB = /usr/X11R6/lib -all: options st +CFLAGS := -g -std=gnu99 -O2 -Wall -Wextra -Werror \ + -Wno-sign-compare \ + -Wno-unused-parameter +CPPFLAGS := -DVERSION=\"${VERSION}\" \ + -D_BSD_SOURCE -D_XOPEN_SOURCE=600 \ + -I. -I/usr/include -I${X11INC} \ + $(shell pkg-config --cflags fontconfig) \ + $(shell pkg-config --cflags freetype2) +LDFLAGS := -g -L/usr/lib -L$(X11LIB) +LDLIBS := -lm -lc -lX11 -lutil -lXft \ + $(shell pkg-config --libs fontconfig) \ + $(shell pkg-config --libs freetype2) -options: - @echo st build options: - @echo "CFLAGS = ${CFLAGS}" - @echo "LDFLAGS = ${LDFLAGS}" - @echo "CC = ${CC}" +all: st -config.h: - cp config.def.h config.h +OBJS = st.o term.o +DEP_FILES := $(wildcard *.d) -.c.o: - @echo CC $< - @${CC} -c ${CFLAGS} $< +ifneq ($(DEP_FILES),) + -include $(DEP_FILES) +endif -${OBJ}: config.h config.mk +st: $(OBJS) -st: ${OBJ} - @echo CC -o $@ - @${CC} -o $@ ${OBJ} ${LDFLAGS} +%.o %.d: %.c + $(CC) $(CPPFLAGS) $(CFLAGS) -MD -MP -MF $*.d -c $< -o $*.o -clean: - @echo cleaning - @rm -f st ${OBJ} st-${VERSION}.tar.gz +config.h: + cp config.def.h config.h -dist: clean - @echo creating dist tarball - @mkdir -p st-${VERSION} - @cp -R LICENSE Makefile README config.mk config.def.h st.info st.1 ${SRC} st-${VERSION} - @tar -cf st-${VERSION}.tar st-${VERSION} - @gzip st-${VERSION}.tar - @rm -rf st-${VERSION} +clean: + $(RM) st $(OBJS) $(DEP_FILES) install: all @echo installing executable file to ${DESTDIR}${PREFIX}/bin - @mkdir -p ${DESTDIR}${PREFIX}/bin - @cp -f st ${DESTDIR}${PREFIX}/bin - @chmod 755 ${DESTDIR}${PREFIX}/bin/st - @echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 - @mkdir -p ${DESTDIR}${MANPREFIX}/man1 - @sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 - @chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 - @echo Please see the README file regarding the terminfo entry of st. - @tic -s st.info + mkdir -p ${DESTDIR}${PREFIX}/bin + cp -f st ${DESTDIR}${PREFIX}/bin + chmod 755 ${DESTDIR}${PREFIX}/bin/st + echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 + mkdir -p ${DESTDIR}${MANPREFIX}/man1 + sed "s/VERSION/${VERSION}/g" < st.1 > ${DESTDIR}${MANPREFIX}/man1/st.1 + chmod 644 ${DESTDIR}${MANPREFIX}/man1/st.1 + echo Please see the README file regarding the terminfo entry of st. + tic -s st.info uninstall: - @echo removing executable file from ${DESTDIR}${PREFIX}/bin - @rm -f ${DESTDIR}${PREFIX}/bin/st - @echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 - @rm -f ${DESTDIR}${MANPREFIX}/man1/st.1 + $(RM) ${DESTDIR}${PREFIX}/bin/st + $(RM) ${DESTDIR}${MANPREFIX}/man1/st.1 -.PHONY: all options clean dist install uninstall +.PHONY: clean install uninstall |