aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-03-23 17:50:42 +0000
committerJoursoir <chat@joursoir.net>2021-03-23 17:50:42 +0000
commit7ee736993663501dd0c4754f05fdd32a59977be5 (patch)
treee14b6c04ad983696a3738d7161670b98175129c2
parente06f9fcb689878878469e2396617786ed525ca87 (diff)
downloadlock-password-7ee736993663501dd0c4754f05fdd32a59977be5.tar.gz
lock-password-7ee736993663501dd0c4754f05fdd32a59977be5.tar.bz2
lock-password-7ee736993663501dd0c4754f05fdd32a59977be5.zip
Makefile: .o files are created in src/; refactor compile
-rwxr-xr-xMakefile31
1 files changed, 19 insertions, 12 deletions
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)