diff options
| author | Tobias Wiese <tobias@tobiaswiese.com> | 2020-05-25 03:01:06 +0200 |
|---|---|---|
| committer | Tobias Wiese <tobias@tobiaswiese.com> | 2020-05-25 03:01:06 +0200 |
| commit | 6b2f03de6f7b533c31d52523d49ede2f627d5bba (patch) | |
| tree | 1b3cac20f8bbc7e6149650874a5f256b294c34de /src | |
| parent | 8bc203cb254638d0070436ccd2b899b56ffbc52d (diff) | |
Makefile: Add install and uninstall target
Adds a target for installation and uninstallation.
Also restructures the makefile a bit, to remove duplication.
Signed-off-by: Tobias Wiese <tobias@tobiaswiese.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/Makefile | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/Makefile b/src/Makefile index 972f55e..339522d 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,8 +1,9 @@ -CC := gcc -CFLAGS := -Wall -LDFLAGS := +INSTALL = install -CFLAGS += -DVERSIN="\"$(shell git describe --dirty --always)\"" +VERSION = $(shell git describe --dirty --always) + +CFLAGS += -Wall -DVERSION="\"$(VERSION)\"" +LDFLAGS += TARGETS := exchange MAINS := $(addsuffix .o, $(TARGETS)) @@ -13,7 +14,16 @@ all: $(TARGETS) .PHONY: clean clean: - rm -rf $(OBJ) $(TARGETS) + rm -f $(OBJ) $(TARGETS) + +.PHONY: install +install: $(TARGETS) + $(INSTALL) -Dt "$(DESTDIR)$(prefix)/bin" $(TARGETS) + +.PHONY: uninstall +uninstall: + cd $(DESTDIR)$(prefix)/bin && rm -f $(TARGETS) + $(TARGETS): % : %.o $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ |
