From 7ee736993663501dd0c4754f05fdd32a59977be5 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Tue, 23 Mar 2021 17:50:42 +0000 Subject: Makefile: .o files are created in src/; refactor compile --- Makefile | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4aa7e94..7c7c2ed 100755 --- a/Makefile +++ b/Makefile @@ -1,13 +1,21 @@ PREFIX = /usr/local/bin CC = gcc -CFLAGS = -Wall -g \ - $(shell gpgme-config --cflags --libs) #-DDEBUG +CFLAGS = -Wall -g #-DDEBUG +LIBS = $(shell gpgme-config --cflags --libs) +MAN_PATH = /usr/share/man/man1 +SOURCES = src/main.c \ + src/exec-cmd.c \ + src/routines.c \ + src/easydir.c \ + src/r-gpgme.c \ + src/tree.c \ + src/xstd.c ifdef DISPLAY - CFLAGS += -lX11 -DDISPLAY + LIBS += -lX11 + CFLAGS += -DDISPLAY + SOURCES += src/r-x11.c endif -MAN_PATH = /usr/share/man/man1 -SOURCES = src/*.c -OBJECTS = *.o +OBJECTS = ${SOURCES:.c=.o} MAN_SOURCES = man/lpass.1 MAN_OBJECTS = lpass.1.gz EXECUTABLE = lpass @@ -17,14 +25,13 @@ EXECUTABLE = lpass all: $(EXECUTABLE) clean: - @rm -rf $(EXECUTABLE) $(OBJECTS) - @rm -rf $(MAN_OBJECTS) - -$(OBJECTS): - @$(CC) -c $(CFLAGS) $(SOURCES) + @rm -rf $(EXECUTABLE) $(OBJECTS) $(MAN_OBJECTS) $(EXECUTABLE): $(OBJECTS) - @$(CC) $(CFLAGS) -o $(EXECUTABLE) $(OBJECTS) + @$(CC) $(CFLAGS) $(LIBS) -o $(EXECUTABLE) $(OBJECTS) + +%.o: %.c + @$(CC) $(CFLAGS) $(LIBS) -c $< -o $@ install: all @echo installing files to $(PREFIX) -- cgit v1.2.3-18-g5258