From 3e0c48f127f9e7fbf43281e10e12a11fbb245de9 Mon Sep 17 00:00:00 2001 From: Humm Date: Wed, 29 Apr 2020 18:51:09 +0200 Subject: [PATCH] make Makefile POSIX conform --- Makefile | 27 ++++++++++++++++++++------- config.mak | 0 2 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 config.mak diff --git a/Makefile b/Makefile index 08517d6..2f48d01 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,29 @@ # Use config.mak to override any of the following variables. # Do not make changes here. +.POSIX: + prefix = /usr/local bindir = $(prefix)/bin mandir = $(prefix)/share/man -SRCS := $(sort $(wildcard *.c)) -OBJS := $(SRCS:.c=.o) +OBJS = display.o \ + file.o \ + hexedit.o \ + interact.o \ + mark.o \ + misc.o \ + page.o \ + search.o -CFLAGS += -Wall -D_GNU_SOURCE -pipe +CFLAGS = -Wall -D_GNU_SOURCE -pipe --include config.mak +include config.mak all: hexedit +$(OBJS): hexedit.h + install: hexedit hexedit.1 install -D -m 755 hexedit $(DESTDIR)$(bindir)/hexedit install -D -m 644 hexedit.1 $(DESTDIR)$(mandir)/man1/hexedit.1 @@ -23,9 +33,12 @@ clean: rm -f $(OBJS) hexedit: $(OBJS) - $(CC) $(LDFLAGS) $(OBJS) -o hexedit -lncurses + $(CC) $(LDFLAGS) -o hexedit $(OBJS) -lncurses + +.SUFFIXES: +.SUFFIXES: .o .c -%.o: %.c hexedit.h - $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $< +.c.o: + $(CC) $(CPPFLAGS) $(CFLAGS) -c $< .PHONY: all clean install diff --git a/config.mak b/config.mak new file mode 100644 index 0000000..e69de29