From ba9e5e94e3c0622a0dc5a91dcb0fe671cb35c07c Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Wed, 3 Jan 2024 00:35:20 -0500 Subject: initial commit --- Makefile | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c0faff2 --- /dev/null +++ b/Makefile @@ -0,0 +1,73 @@ +# Makefile for hcalc. Requires GNU make. + +PROJ = hcalc + +CC = gcc +CFLAGS = -Wall -g + +DESTDIR = +PREFIX = /usr +BINDIR = $(PREFIX)/bin +SHAREDIR = $(PREFIX)/share +MANDIR = $(SHAREDIR)/man +MAN1DIR = $(MANDIR)/man1 +DOCDIR = $(SHAREDIR)/doc/$(PROJ) +ICONDIR = $(SHAREDIR)/icons/hicolor +DESKTOPDIR = $(SHAREDIR)/applications +INSTALL = install +INSTALL_DATA = $(INSTALL) -m0644 +INSTALL_PROG = $(INSTALL) -s -m0755 +ifeq ($(shell whoami),root) +INSTALL_USER = -o root -g root +else +INSTALL_USER = +endif +MKDIR_P = mkdir -p +GZIP = gzip + +MANPAGE = $(PROJ).1 +OBJS = \ + hcalc.o \ + input.o \ + setupx.o \ + images.o \ + draw.o \ + config.o + +all: $(PROJ) $(MANPAGE) + +hcalc.o: hcalc.c hcalc.h + +input.o: input.c hcalc.h + +setupx.o: setupx.c hcalc.h + +draw.o: draw.c hcalc.h + +config.o: config.c hcalc.h + +images.o: images.c hcalc.h xpm/*.xpm + +$(PROJ): $(OBJS) + $(CC) -o $@ $^ $(LDFLAGS) -lXpm -lX11 + +$(MANPAGE): $(PROJ).rst + rst2man.py $(PROJ).rst > $(MANPAGE) + +clean: + rm -f *.o *.d *~ \#* $(PROJ) core + +install: all + $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(SHAREDIR) \ + $(DESTDIR)$(MAN1DIR) $(DESTDIR)$(DOCDIR) $(DESTDIR)$(DESKTOPDIR) + $(INSTALL_PROG) $(INSTALL_USER) $(PROJ) $(DESTDIR)$(BINDIR) + $(INSTALL_DATA) $(INSTALL_USER) $(MANPAGE) $(DESTDIR)$(MAN1DIR) + $(INSTALL_DATA) $(INSTALL_USER) README CHANGES TODO $(DESTDIR)$(DOCDIR) + $(INSTALL_DATA) $(INSTALL_USER) desktop/$(PROJ).desktop $(DESTDIR)$(DESKTOPDIR) + for i in 16x16 22x22 32x32 48x48 64x64; do \ + $(MKDIR_P) $(DESTDIR)$(ICONDIR)/$$i/apps ; \ + $(INSTALL_DATA) $(INSTALL_USER) icons/$$i/apps/$(PROJ).png $(DESTDIR)$(ICONDIR)/$$i/apps ; \ + done + $(GZIP) -9f $(DESTDIR)$(MAN1DIR)/$(MANPAGE) + +.PHONY: all clean install -- cgit v1.2.3