aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 301885be25a591c1c9ebf8b9beff616d184c08ce (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
PROGNAME=jaospkg
VERSION=0.8
CC=gcc
CURLFLAGS=`curl-config --libs`
CFLAGS=-W -Werror -Wall -O2 -ansi -pedantic -Iinclude
DEBUGFLAGS=-W -Werror -Wall -ansi -pedantic -Iinclude -g
OBJS=src/configuration.o src/package.o src/curl.o src/action.o src/main.o
RCDEST=/etc/jaospkgrc
RCSOURCE=example.jaospkgrc
SBINDIR=/sbin/

default: all

all: $(PROGNAME)

$(OBJS): 

$(PROGNAME): $(OBJS)
	$(CC) $(CFLAGS) $(CURLFLAGS) -o $(PROGNAME) $(OBJS)

$(PROGNAME)-debug: $(OBJS)
	$(CC) $(DEBUGFLAGS) $(CURLFLAGS) -o $(PROGNAME) $(OBJS)

install: $(PROGNAME)
	install $(PROGNAME) $(SBINDIR)
	install --mode=0644 -b $(RCSOURCE) $(RCDEST)
	install $(PROGNAME).8 /usr/man/man8/

uninstall:
	-rm /sbin/$(PROGNAME)
	-@echo leaving $(RCDEST)

clean:
	-if [ -f $(PROGNAME) ]; then rm $(PROGNAME);fi
	-rm src/*.o
	-if [ -d slackpkg ]; then rm -rf slackpkg ;fi

slackpkg: $(PROGNAME)
	-@mkdir slackpkg
	-@mkdir -p slackpkg/sbin
	-@mkdir -p slackpkg/etc
	-@mkdir -p slackpkg/install
	-@mkdir -p slackpkg/usr/man/man8
	-@cp $(PROGNAME) ./slackpkg/sbin/
	-@cp example.jaospkgrc ./slackpkg/etc/jaospkgrc
	-@mkdir -p ./slackpkg/usr/doc/$(PROGNAME)-$(VERSION)/
	-@cp COPYING Changelog INSTALL README TODO ./slackpkg/usr/doc/$(PROGNAME)-$(VERSION)/
	-@cp slack-desc slackpkg/install/
	-@cp $(PROGNAME).8 slackpkg/usr/man/man8/
	@( cd slackpkg; makepkg -c y $(PROGNAME)-$(VERSION).tgz )