forked from datto/dattobd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
73 lines (53 loc) · 2.14 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# SPDX-License-Identifier: GPL-2.0-only
export CC = gcc
export RM = rm -f
CFLAGS ?= -Wall
export CCFLAGS = $(CFLAGS) -std=gnu99
export PREFIX = /usr/local
export BASE_DIR = $(abspath .)
BUILDDIR := $(CURDIR)/pkgbuild
# Flags to pass to debbuild/rpmbuild
PKGBUILDFLAGS := --define "_topdir $(BUILDDIR)" -ba --with devmode
# Command to create the build directory structure
PKGBUILDROOT_CREATE_CMD = mkdir -p $(BUILDDIR)/DEBS $(BUILDDIR)/SDEBS $(BUILDDIR)/RPMS $(BUILDDIR)/SRPMS \
$(BUILDDIR)/SOURCES $(BUILDDIR)/SPECS $(BUILDDIR)/BUILD $(BUILDDIR)/BUILDROOT
.PHONY: all driver library-shared library-static library application application-shared utils clean install uninstall pkgclean pkgprep deb rpm
all: driver library application utils
driver:
$(MAKE) -C src
library-shared:
$(MAKE) -C lib CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src" shared
library-static:
$(MAKE) -C lib CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src" static
library: library-shared library-static
application-static: library-static
$(MAKE) -C app CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src -I$(BASE_DIR)/lib"
application: library-shared
$(MAKE) -C app CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src -I$(BASE_DIR)/lib" shared
utils: library-shared
$(MAKE) -C utils CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src -I$(BASE_DIR)/lib -D_XOPEN_SOURCE=500"
clean:
$(MAKE) -C src clean
$(MAKE) -C lib clean
$(MAKE) -C app clean
$(MAKE) -C utils clean
pkgclean:
rm -rf $(BUILDDIR)
pkgprep: pkgclean
$(PKGBUILDROOT_CREATE_CMD)
tar --exclude=./pkgbuild --exclude=.git --transform 's,^\.,dattobd,' -czf $(BUILDDIR)/SOURCES/dattobd.tar.gz .
cp dist/dattobd.spec $(BUILDDIR)/SPECS/dattobd.spec
deb: pkgprep
debbuild $(PKGBUILDFLAGS) $(BUILDDIR)/SPECS/dattobd.spec
rpm: pkgprep
rpmbuild $(PKGBUILDFLAGS) $(BUILDDIR)/SPECS/dattobd.spec
install:
$(MAKE) -C src install
$(MAKE) -C lib install CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src"
$(MAKE) -C app install CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src -I$(BASE_DIR)/lib"
$(MAKE) -C utils install CCFLAGS="$(CCFLAGS) -I$(BASE_DIR)/src -I$(BASE_DIR)/lib -D_XOPEN_SOURCE=500"
uninstall:
$(MAKE) -C app uninstall
$(MAKE) -C utils uninstall
$(MAKE) -C lib uninstall
$(MAKE) -C src uninstall