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
|
||||
*.out
|
||||
*.hex
|
||||
*.gz
|
||||
|
||||
# Ignore /bin/ directory
|
||||
/bin/
|
||||
|
||||
91
Makefile
91
Makefile
@@ -3,43 +3,72 @@
|
||||
|
||||
include config.mk
|
||||
|
||||
SRC = drw.c dwm.c util.c
|
||||
OBJ = ${SRC:.c=.o}
|
||||
INSTALL ?= install
|
||||
GZIP ?= gzip
|
||||
TAR ?= tar
|
||||
|
||||
all: dwm
|
||||
SRC = $(wildcard src/*.c)
|
||||
OBJ = $(addsuffix .o,$(SRC))
|
||||
DEP = $(addsuffix .d,$(SRC))
|
||||
|
||||
.c.o:
|
||||
${CC} -c ${CFLAGS} $<
|
||||
# Set Q to @ to silence commands being printed, unless --no-silent has been set
|
||||
ifeq (0, $(words $(findstring --no-silent,$(MAKEFLAGS))))
|
||||
Q=@
|
||||
endif
|
||||
|
||||
${OBJ}: config.h config.mk
|
||||
msg = @printf '%-8s %s\n' "$(1)" "$(2)"
|
||||
|
||||
config.h:
|
||||
cp config.def.h $@
|
||||
.PHONY:
|
||||
all: bin/dwm
|
||||
|
||||
dwm: ${OBJ}
|
||||
${CC} -o $@ ${OBJ} ${LDFLAGS}
|
||||
.PHONY:
|
||||
install: $(DESTDIR)/bin/dwm $(DESTDIR)/share/man/man1/dwm.1.gz
|
||||
$(DESTDIR)/bin/%: bin/%
|
||||
$(call msg,INSTALL,$@)
|
||||
$(Q)$(INSTALL) -D -m0755 $< $@
|
||||
|
||||
clean:
|
||||
rm -f dwm ${OBJ} dwm-${VERSION}.tar.gz
|
||||
|
||||
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
|
||||
$(DESTDIR)/share/man/%: man/%
|
||||
$(call msg,INSTALL,$@)
|
||||
$(Q)$(INSTALL) -D -m0644 $< $@
|
||||
|
||||
.PHONY:
|
||||
uninstall:
|
||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||
$(Q)$(RM) $(DESTDIR)/bin/dwm\
|
||||
$(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