Rework makefile and worktree.
Moved most source files to /src/ Renamed `LICENSE` to `COPYING` to reduce (my personal) misspellings. Rewrote Makefile to be more Quinn-friendly, and removed some components not necessary for me, since this is a personal project.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -8,6 +8,7 @@
|
|||||||
*.so
|
*.so
|
||||||
*.out
|
*.out
|
||||||
*.hex
|
*.hex
|
||||||
|
*.gz
|
||||||
|
|
||||||
# Ignore /bin/ directory
|
# Ignore /bin/ directory
|
||||||
/bin/
|
/bin/
|
||||||
|
|||||||
91
Makefile
91
Makefile
@@ -3,43 +3,72 @@
|
|||||||
|
|
||||||
include config.mk
|
include config.mk
|
||||||
|
|
||||||
SRC = drw.c dwm.c util.c
|
INSTALL ?= install
|
||||||
OBJ = ${SRC:.c=.o}
|
GZIP ?= gzip
|
||||||
|
TAR ?= tar
|
||||||
|
|
||||||
all: dwm
|
SRC = $(wildcard src/*.c)
|
||||||
|
OBJ = $(addsuffix .o,$(SRC))
|
||||||
|
DEP = $(addsuffix .d,$(SRC))
|
||||||
|
|
||||||
.c.o:
|
# Set Q to @ to silence commands being printed, unless --no-silent has been set
|
||||||
${CC} -c ${CFLAGS} $<
|
ifeq (0, $(words $(findstring --no-silent,$(MAKEFLAGS))))
|
||||||
|
Q=@
|
||||||
|
endif
|
||||||
|
|
||||||
${OBJ}: config.h config.mk
|
msg = @printf '%-8s %s\n' "$(1)" "$(2)"
|
||||||
|
|
||||||
config.h:
|
.PHONY:
|
||||||
cp config.def.h $@
|
all: bin/dwm
|
||||||
|
|
||||||
dwm: ${OBJ}
|
.PHONY:
|
||||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
install: $(DESTDIR)/bin/dwm $(DESTDIR)/share/man/man1/dwm.1.gz
|
||||||
|
$(DESTDIR)/bin/%: bin/%
|
||||||
|
$(call msg,INSTALL,$@)
|
||||||
|
$(Q)$(INSTALL) -D -m0755 $< $@
|
||||||
|
|
||||||
clean:
|
$(DESTDIR)/share/man/%: man/%
|
||||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
$(call msg,INSTALL,$@)
|
||||||
|
$(Q)$(INSTALL) -D -m0644 $< $@
|
||||||
dist: clean
|
|
||||||
mkdir -p dwm-${VERSION}
|
|
||||||
cp -R LICENSE Makefile README config.def.h config.mk\
|
|
||||||
dwm.1 drw.h util.h ${SRC} dwm.png transient.c dwm-${VERSION}
|
|
||||||
tar -cf dwm-${VERSION}.tar dwm-${VERSION}
|
|
||||||
gzip dwm-${VERSION}.tar
|
|
||||||
rm -rf dwm-${VERSION}
|
|
||||||
|
|
||||||
install: all
|
|
||||||
mkdir -p ${DESTDIR}${PREFIX}/bin
|
|
||||||
cp -f dwm ${DESTDIR}${PREFIX}/bin
|
|
||||||
chmod 755 ${DESTDIR}${PREFIX}/bin/dwm
|
|
||||||
mkdir -p ${DESTDIR}${MANPREFIX}/man1
|
|
||||||
sed "s/VERSION/${VERSION}/g" < dwm.1 > ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
|
||||||
chmod 644 ${DESTDIR}${MANPREFIX}/man1/dwm.1
|
|
||||||
|
|
||||||
|
.PHONY:
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
$(Q)$(RM) $(DESTDIR)/bin/dwm\
|
||||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
$(DESTDIR)/share/man/man1/dwm.1.gz
|
||||||
|
|
||||||
.PHONY: all clean dist install uninstall
|
.PHONY:
|
||||||
|
clean:
|
||||||
|
$(call msg,CLEAN,src/)
|
||||||
|
$(Q)$(RM) $(OBJ)
|
||||||
|
$(call msg,CLEAN,man/)
|
||||||
|
$(Q)$(RM) $(MAN)
|
||||||
|
$(call msg,CLEAN,bin/)
|
||||||
|
$(Q)$(RM) -r bin/
|
||||||
|
|
||||||
|
# Links together the object files into the final binary.
|
||||||
|
bin/dwm: $(OBJ) | bin/
|
||||||
|
$(call msg,LD,$@)
|
||||||
|
$(Q)$(CC) $(LDFLAGS) $(LDLIBS) -o $@ $^
|
||||||
|
|
||||||
|
# Compiles C sources into Object files
|
||||||
|
%.c.o: %.c
|
||||||
|
$(call msg,CC,$@)
|
||||||
|
$(Q)$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
# Compress files requested for compression using GZIP
|
||||||
|
%.gz: %
|
||||||
|
$(call msg,GZIP,$@)
|
||||||
|
$(Q)$(GZIP) -k $<
|
||||||
|
|
||||||
|
# Create directories
|
||||||
|
%/:
|
||||||
|
$(call msg-mkdir,$@)
|
||||||
|
$(Q)mkdir $@
|
||||||
|
|
||||||
|
# Generate and include dependencies,
|
||||||
|
# ignoring any errors that may occur when doing so.
|
||||||
|
%.c.d: %.c
|
||||||
|
$(Q)$(CC) -MM $(CPPFLAGS) -MF $@ $<
|
||||||
|
ifeq (0, $(words $(findstring $(MAKECMDGOALS), clean)))
|
||||||
|
-include $(DEP)
|
||||||
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user