From ebfaff7586bda50f5901d32d1d39dfe72d344d12 Mon Sep 17 00:00:00 2001 From: Timo Engel Date: Fri, 13 Mar 2026 21:20:37 +0100 Subject: [PATCH] replace Makefile --- Makefile | 62 +++++++++++++++++--------------------------------------- 1 file changed, 19 insertions(+), 43 deletions(-) diff --git a/Makefile b/Makefile index 7415929..16e06c9 100644 --- a/Makefile +++ b/Makefile @@ -1,45 +1,21 @@ -CC= gcc -LDFLAGS= -L/usr/lib -L/usr/local/lib -L/usr/lib/ncurses -L/usr/local/lib/ncurses -CPPFLAGS= -I/usr/include -I/usr/local/include -I/usr/include/ncurses -I/usr/local/include/ncurses -CFLAGS= -O3 -Wall -std=c99 -#CFLAGS+= -ffunction-sections -fdata-sections -#LDFLAGS+= --gc-sections -LIBS= -lncurses -DESTDIR= /usr/local/ - -OFILES=buffers.o \ - configfile.o \ - correlation.o \ - gpl.o \ - hexcalc.o \ - input.o \ - machine_type.o \ - main.o \ - markers.o \ - menu.o \ - output.o \ - search.o \ - ui.o - -all: dhex - -dhex: $(OFILES) - $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) - -install:all - strip dhex - cp dhex $(DESTDIR)/bin - cp dhex.1 $(DESTDIR)/man/man1 - cp dhexrc.5 $(DESTDIR)/man/man5 - cp dhex_markers.5 $(DESTDIR)/man/man5 - cp dhex_searchlog.5 $(DESTDIR)/man/man5 - - - -.c.o: - $(CC) $< -c -I. $(CPPFLAGS) $(CFLAGS) $(OPTIONS) - +SRC:=buffers.c configfile.c correlation.c gpl.c hexcalc.c input.c \ + machine_type.c main.c markers.c menu.c output.c search.c ui.c +OBJ:=$(patsubst %.c,%.o,$(SRC)) +DEP:=$(patsubst %.c,%.d,$(SRC)) +CFLAGS:=-Wall -MMD $(shell pkgconf --cflags ncurses) +LDFLAGS:=$(shell pkgconf --libs ncurses) +TARGET=dhex + +$(TARGET): $(OBJ) + @echo linking $(TARGET) + @gcc $(OBJ) $(LDFLAGS) -o $(TARGET) + +%.o: %.c + @echo compiling $< + @gcc $(CFLAGS) -c $< -o $@ + +.PHONY: clean clean: - rm -f dhex $(OFILES) - + @rm -f $(OBJ) $(DEP) $(TARGET) +-include $(DEP)