Skip to content

Instantly share code, notes, and snippets.

@Anskrevy
Created October 27, 2022 04:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Anskrevy/52fa06719ad204cc99eb190bf20ddd84 to your computer and use it in GitHub Desktop.
Save Anskrevy/52fa06719ad204cc99eb190bf20ddd84 to your computer and use it in GitHub Desktop.
VERSION = 0.0.1
# paths
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
# freetype
FREETYPELIBS = -lfontconfig -lXft
FREETYPEINC = /usr/include/freetype2
# OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2
# includes and libs
INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${FREETYPELIBS} -lXrender
# flags
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\"
CFLAGS = -g -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}
# compiler and linker
CC = cc
OUT = xfonts
SRC = xfonts.c
OBJ = ${SRC:.c=.o}
include config.mk
all: options ${OUT}
options:
@echo ${OUT} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
@echo "SRC = ${SRC}"
%.o:%.c
${CC} -c ${CFLAGS} -o $@ $<
${OBJ}: config.mk
${OUT}: ${OBJ}
${CC} -o $@ ${OBJ} ${LDFLAGS}
.PHONY: all options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment