aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: e9622df3f2b12fb36e9616248a26d1b202fe4478 (plain)
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
54
55
56
57
58
59
60
61
# Things we build and install
BIN_FILES=swabber load_distro swabprof swab_testf

# Scripts we install
SCRIPTS=update_distro detect_distro

ALL_INSTALL=$(BIN_FILES) $(SCRIPTS)

# Things we build but don't install
BIN_OTHER=dump_blob canonicalize

FILTER_FILES=distros

# Installation directories
bindir = /usr/bin
filterdir= /usr/share/swabber

swabber_SRC=swabber.c lists.c wandering.c canonicalize.c
swabber_OBJ=$(patsubst %.c,%.o,$(swabber_SRC))

CFLAGS=-Wall -g

all: ${BIN_FILES} ${BIN_OTHER}

# Header file dependencies
dump_blob load_distro $(swabber_OBJ): packages.h
lists.o swabber.o: lists.h
swabber.o wandering.o: wandering.h
swabber.o wandering.o: swabber.h
canonicalize swabber.o: canonicalize.h

load_distro swab_testf dump_blob: %: %.c
	${CC} ${CFLAGS} -o $@ $<

canonicalize: %: %.c
	${CC} ${CFLAGS} -DTEST_PROGRAM -o $@ $<

swabber: ${swabber_OBJ}
	${CC} ${CFLAGS} -o $@ ${swabber_OBJ}

swabprof: swabprof.in
	sed -e 's![@]filtersdir[@]!$(DESTDIR)$(filterdir)!g' \
		swabprof.in > $@
	chmod 755 $@


.PHONY : clean install uninstall

clean:
	rm -f ${BIN_FILES} ${BIN_OTHER} *.o

install: all
	mkdir -p $(DESTDIR)$(filterdir)
	cp -a ${FILTER_FILES} $(DESTDIR)$(filterdir)
	mkdir -p $(DESTDIR)$(bindir)
	install $(ALL_INSTALL) $(DESTDIR)$(bindir)

uninstall:
	for filename in $(ALL_INSTALL) ; do \
		rm -f $(DESTDIR)$(bindir)/$${filename} ; \
	done