]> git.ipfire.org Git - people/ms/rstp.git/blob - Makefile
update ignore file
[people/ms/rstp.git] / Makefile
1
2 DSOURCES = brmon.c brstate.c libnetlink.c epoll_loop.c bridge_track.c ctl_socket.c netif_utils.c main.c
3
4 DOBJECTS = $(DSOURCES:.c=.o)
5
6 CTLSOURCES = ctl_main.c ctl_cli_wrap.c ctl_socket_client.c
7
8 CTLOBJECTS = $(CTLSOURCES:.c=.o)
9
10 CC=gcc
11 CFLAGS = -Wall -Werror -O2 -g -D_REENTRANT -D__LINUX__ -DVERSION=$(version) -DBUILD=$(build) -DSTP_DBG=1 -I. -I./include -I./rstplib
12
13 all: rstpd rstpctl
14
15 rstplib:
16 make -C rstplib librstp.a
17
18 .PHONY: rstplib
19
20 rstpd: $(DOBJECTS) rstplib
21 $(CC) -o $@ $(DOBJECTS) -L ./rstplib -lrstp
22
23 rstpctl: $(CTLOBJECTS)
24 $(CC) -o $@ $(CTLOBJECTS)
25
26 clean:
27 rm -f *.o rstpd rstpctl
28 make -C rstplib clean
29 rm -fr $(TOPDIR) $(BUILDDIR)
30
31 install: all
32 install -m 755 -d $(INSTALLPREFIX)/sbin
33 install -m 755 rstpd $(INSTALLPREFIX)/sbin
34 install -m 755 rstpctl $(INSTALLPREFIX)/sbin
35 install -m 755 -d $(INSTALLPREFIX)/usr/share/man/man8
36 install -m 644 rstpd.8 $(INSTALLPREFIX)/usr/share/man/man8
37 install -m 644 rstpctl.8 $(INSTALLPREFIX)/usr/share/man/man8
38
39 # RPM Building, as non root
40 version := 0.16
41 build := 1
42
43 BUILDROOT := $(CURDIR)/rpm_buildroot
44 TOPDIR := $(CURDIR)/rpm_topdir
45
46 RPMBUILD=rpmbuild
47 RPMDEFS=\
48 --buildroot=$(BUILDROOT) \
49 --define='_topdir $(TOPDIR)' \
50 --define='VERSION $(version)' \
51 --define='BUILD $(build)'
52
53 rpm:
54 mkdir -p $(BUILDROOT) $(TOPDIR)/BUILD $(TOPDIR)/SOURCES $(TOPDIR)/RPMS
55 (cd .. ; tar cfz $(TOPDIR)/SOURCES/rstp-$(version).tgz --exclude rstp-$(version)/rpm_buildroot --exclude rstp-$(version)/rpm_topdir rstp-$(version))
56 $(RPMBUILD) $(RPMDEFS) -bb rstp.spec
57 cp $(TOPDIR)/RPMS/*/rstp-$(version)-$(build).*.rpm .
58 cp $(TOPDIR)/RPMS/*/rstp-debuginfo-$(version)-$(build).*.rpm .
59