-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
166 lines (148 loc) · 5.47 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#
# libslack - https://libslack.org
#
# Copyright (C) 1999-2004, 2010, 2020-2023 raf <raf@raf.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# 20230824 raf <raf@raf.org>
#
CC := gcc
# CC := cc
# CC := other
AR := ar
RANLIB := ranlib
POD2MAN := pod2man
POD2HTML := pod2html
GZIP := gzip -f -9
DESTDIR :=
PREFIX := /usr/local
# PREFIX := /usr/pkg
APP_INSDIR := $(PREFIX)/bin
LIB_INSDIR := $(PREFIX)/lib
MAN_SYSDIR := $(PREFIX)/share/man
MAN_LOCDIR := $(PREFIX)/share/man
ifeq ($(PREFIX),/usr)
MAN_INSDIR := $(MAN_SYSDIR)
else
MAN_INSDIR := $(MAN_LOCDIR)
endif
HDR_INSDIR := $(PREFIX)/include
DATA_INSDIR := $(PREFIX)/share
APP_MANSECT := 1
LIB_MANSECT := 3
APP_MANDIR := $(MAN_INSDIR)/man$(APP_MANSECT)
LIB_MANDIR := $(MAN_INSDIR)/man$(LIB_MANSECT)
APP_MANSECTNAME := User Commands
LIB_MANSECTNAME := C Library Functions - libslack
MAN_GZIP := 1
CCFLAGS += -O3
CCFLAGS += -Wall -pedantic
# CCFLAGS += -xO4
CLEAN_FILES += tags core Makefile.bak .makefile.bak pod2htm*
SLACK_SRCDIR := .
SLACK_INCDIRS := .
SLACK_LIBDIRS := .
include $(SLACK_SRCDIR)/macros.mk
.PHONY: all ready test check man html install uninstall dist rpm deb sol
all: ready $(ALL_TARGETS)
ready: $(READY_TARGETS)
check test: all $(TEST_TARGETS)
man: $(MAN_TARGETS)
html: $(HTML_TARGETS)
install: all $(INSTALL_TARGETS)
uninstall: $(UNINSTALL_TARGETS)
dist: $(DIST_TARGETS)
rpm: $(RPM_TARGETS)
deb: $(DEB_TARGETS)
sol: $(SOL_TARGETS)
obsd: $(OBSD_TARGETS)
fbsd: $(FBSD_TARGETS)
nbsd: $(NBSD_TARGETS)
osx: $(OSX_TARGETS)
.PHONY: help help-macros depend clean clobber distclean
help::
@echo "This makefile provides the following targets."; \
echo; \
echo " help -- shows this list of targets"; \
echo " help-macros -- shows the values of all make macros"; \
echo " all -- makes $(SLACK_TARGET) (default)"; \
echo " ready -- prepares the source directory for compilation"; \
echo " test -- makes and runs library unit tests"; \
echo " check -- same as test"; \
echo " man -- generates all manpages"; \
echo " html -- generates all manpages in html"; \
echo " install -- installs everything under $(PREFIX)"; \
echo " uninstall -- uninstalls everything from $(PREFIX)"; \
echo " depend -- generates source dependencies using makedepend"; \
echo " tags -- generates a tags file using ctags"; \
echo " clean -- removes output files, tags, tests, and de-configures"; \
echo " clobber -- same as clean"; \
echo " distclean -- same as clean"; \
echo " dist -- makes the distribution: ../$(SLACK_DIST)"; \
echo " rpm -- makes source and binary rpm packages [OLD]"; \
echo " deb -- makes source and binary debian packages [OLD]"; \
echo " sol -- makes binary solaris package [OLD]"; \
echo " obsd -- makes binary openbsd package [OLD]"; \
echo " fbsd -- makes binary freebsd package [OLD]"; \
echo " nbsd -- makes binary netbsd package [OLD]"; \
echo " osx -- makes binary macosx package [OLD]"; \
echo; \
echo " slack.swig -- makes SWIG input file for libslack"; \
echo
help-macros::
@echo "CC = $(CC)"; \
echo "PREFIX = $(PREFIX)"; \
echo "APP_INSDIR = $(APP_INSDIR)"; \
echo "LIB_INSDIR = $(LIB_INSDIR)"; \
echo "MAN_INSDIR = $(MAN_INSDIR)"; \
echo "HDR_INSDIR = $(HDR_INSDIR)"; \
echo "DATA_INSDIR = $(DATA_INSDIR)"; \
echo "APP_MANSECT = $(APP_MANSECT)"; \
echo "LIB_MANSECT = $(LIB_MANSECT)"; \
echo "APP_MANDIR = $(APP_MANDIR)"; \
echo "LIB_MANDIR = $(LIB_MANDIR)"; \
echo "TAG_FILES = $(TAG_FILES)"; \
echo "DEPEND_CFILES = $(DEPEND_CFILES)"; \
echo "DEPEND_HFILES = $(DEPEND_HFILES)"; \
echo "CCFLAGS = $(CCFLAGS)"; \
echo "READY_TARGETS = $(READY_TARGETS)"; \
echo "ALL_TARGETS = $(ALL_TARGETS)"; \
echo "TEST_TARGETS = $(TEST_TARGETS)"; \
echo "MAN_TARGETS = $(MAN_TARGETS)"; \
echo "HTML_TARGETS = $(HTML_TARGETS)"; \
echo "INSTALL_TARGETS = $(INSTALL_TARGETS)"; \
echo "UNINSTALL_TARGETS = $(UNINSTALL_TARGETS)"; \
echo "CLEAN_FILES = $(CLEAN_FILES)"; \
echo "CLOBBER_FILES = $(CLOBBER_FILES)"; \
echo "DIST_TARGETS = $(DIST_TARGETS)"; \
echo "RPM_TARGETS = $(RPM_TARGETS)"; \
echo "DEB_TARGETS = $(DEB_TARGETS)"; \
echo "SOL_TARGETS = $(SOL_TARGETS)"; \
echo "OBSD_TARGETS = $(OBSD_TARGETS)"; \
echo "FBSD_TARGETS = $(FBSD_TARGETS)"; \
echo "NBSD_TARGETS = $(NBSD_TARGETS)"; \
echo "OSX_TARGETS = $(OSX_TARGETS)"; \
echo
tags: $(TAG_FILES)
@ctags $(TAG_FILES)
depend: ready $(DEPEND_CFILES) $(DEPEND_HFILES)
@makedepend $(SLACK_CPPFLAGS) $(DEPEND_CFILES)
clean::
@rm -rf $(CLEAN_FILES) $(CLOBBER_FILES)
@perl -pi -e 'last if /[D]O NOT DELETE/;' $(patsubst %, %/Makefile, $(SLACK_SRCDIR) $(SLACK_SUBDIRS))
./configure --default
clobber:: clean
distclean:: clean
include $(SLACK_SRCDIR)/rules.mk