commit 70604d3e5e7044b9e30bea6529352836a9608720 from: Alexander Arkhipov date: Tue May 30 10:25:24 2023 UTC use variables instead of config.mk config.mk turned out to only make things harder, especially with packaging. From now on it should be possible to type things like `make CFALGS="-some -extra -flags"' and expect them to work. commit - 840c16f685ca8f617270f33af0525ae7bff5adc1 commit + 70604d3e5e7044b9e30bea6529352836a9608720 blob - aaece576d7e1389e84b33a76950bf16ff9eb310b blob + 10e141b9757844a31a30e1e7a5159798fa236657 --- Makefile +++ Makefile @@ -1,32 +1,41 @@ -include config.mk include version.mk -.SUFFIXES: .o .c - BIN = xitems OBJ = $(BIN:=.o) SRC = $(BIN:=.c) MAN = $(BIN:=.1) +PREFIX ?= $(DESTDIR)/usr/local +MANPREFIX ?= $(PREFIX)/man +X11BASE ?= /usr/X11R6 +X11INC ?= $(X11BASE)/include +X11LIB ?= $(X11BASE)/lib +FREETYPEINC ?= $(X11INC)/freetype2 +FREETYPELIBS ?= -lfontconfig -lXft + +INCS = -I$(X11INC) -I$(FREETYPEINC) +LIBS = -L$(X11LIB) -lX11 $(FREETYPELIBS) + +bindir = $(PREFIX)/bin +man1dir = $(MANPREFIX)/man1 + all: $(BIN) $(BIN): $(OBJ) - $(CC) $(CFLAGS) $(PCCFLAGS) -o $@ $(OBJ) $(LDFLAGS) + $(CC) -o $@ $(OBJ) $(LIBS) $(LDFLAGS) -$(OBJ): config.mk - .c.o: - $(CC) $(CFLAGS) $(CPPFLAGS) -c $< + $(CC) -std=c99 -pedantic $(INCS) $(CFLAGS) $(CPPFLAGS) -c $< install: all - mkdir -p $(DESTDIR)$(PREFIX)/bin - install -m 755 $(BIN) $(DESTDIR)$(PREFIX)/bin - mkdir -p $(DESTDIR)$(MANPREFIX)/man1 - install -m 644 $(MAN) $(DESTDIR)$(MANPREFIX)/man1 + mkdir -p $(bindir) + install -m 755 $(BIN) $(bindir) + mkdir -p $(man1dir) + install -m 644 $(MAN) $(man1dir) uninstall: - cd $(DESTDIR)$(PREFIX)/bin && rm -f $(BIN) - cd $(DESTDIR)$(MANPREFIX)/man1 && rm -f $(MAN) + cd $(bindir) && rm -f $(BIN) + cd $(man1dir) && rm -f $(MAN) clean: -rm -rf $(BIN) $(OBJ) xitems$(V) *.tar.gz *.core blob - f203501e7576702db83a2b8d22d631cb435e2a42 (mode 644) blob + /dev/null --- config.mk +++ /dev/null @@ -1,15 +0,0 @@ -PREFIX ?= /usr/local -MANPREFIX ?= /usr/local/man - -X11INC = /usr/X11R6/include -X11LIB = /usr/X11R6/lib - -FREETYPELIBS = -lfontconfig -lXft -FREETYPEINC = $(X11INC)/freetype2 - -CFLAGS = -std=c99 -Wall -pedantic -CPPFLAGS = -I$(X11INC) -I$(FREETYPEINC) -LDFLAGS = -L$(X11LIB) -lX11 $(FREETYPELIBS) - -# debug -#CFLAGS = -std=c99 -Wall -pedantic -Wextra -O0 -g3