-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
54 lines (39 loc) · 1.32 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#$ make INSTALL_BIN=/my/different/path
INSTALL_BIN = /usr/bin
INSTALL_ETC = /etc/trip
INSTALL_MNT = /mnt/trip
LOCAL_ETC = ./etc-trip
CC = gcc
DFLAGS = -D_POSIX_C_SOURCE=200112L -DTRIP_PATH=\"$(INSTALL_BIN)/trip.sh\"
CFLAGS = -g -Wextra -ansi -pedantic
OBJS = trip.o
EXEC = trip
.PHONY: install-bin install uninstall-bin uninstall clean tgz
$(EXEC): $(OBJS)
$(CC) $(CFLAGS) $(OBJS) -o $(@)
trip.o: trip.c
$(CC) -c $(CFLAGS) $(DFLAGS) trip.c -o $(@)
install-bin: $(EXEC)
install -t $(INSTALL_BIN) $(EXEC) tripskel trip.sh
install: install-bin
# Configs.
install -d $(INSTALL_ETC)
install -t $(INSTALL_ETC) $(LOCAL_ETC)/post_install.sh $(LOCAL_ETC)/post_uninstall.sh
install -m u=rw,go=r -t $(INSTALL_ETC) $(LOCAL_ETC)/conf $(LOCAL_ETC)/exclude
# Mount points.
install -d $(INSTALL_MNT)/lfs $(INSTALL_MNT)/union $(INSTALL_MNT)/pkg
uninstall-bin:
rm -f $(INSTALL_BIN)/$(EXEC) \
$(INSTALL_BIN)/tripskel \
$(INSTALL_BIN)/trip.sh
uninstall: uninstall-bin
rm -f -d $(INSTALL_MNT)/lfs $(INSTALL_MNT)/union $(INSTALL_MNT)/pkg
rm -f -d $(INSTALL_MNT)
# You must manually remove the following:
# /etc/trip/ - Configs.
# /var/lib/trip/ - Metadata about installed packages.
# ??? - Any installed packages.
clean:
rm -f $(OBJS) $(EXEC)
tgz:
git archive --prefix=trip/ master | gzip > ../trip.tgz