procps/Makefile

166 lines
4.5 KiB
Makefile
Raw Normal View History

2002-10-11 02:25:36 +05:30
# procps Makefile
2003-03-19 06:45:58 +05:30
# Albert Cahalan, 2002-2003
2002-10-11 02:25:36 +05:30
#
# Recursive make is considered harmful:
# http://google.com/search?q=%22recursive+make+considered+harmful%22
#
# For now this Makefile uses explicit dependencies. The project
# hasn't grown big enough to need something complicated, and the
# dependency tracking files are an ugly annoyance.
#
# This file includes */module.mk files which add on to variables:
# FOO += bar/baz
2002-10-14 03:16:46 +05:30
#
#
# Set (or uncomment) SKIP if you wish to avoid something.
# For example, you may prefer the /bin/kill from util-linux or bsdutils.
2002-10-11 02:25:36 +05:30
VERSION := 3
2002-11-09 08:31:35 +05:30
SUBVERSION := 1
2003-06-08 22:58:06 +05:30
MINORVERSION := 10
TARVERSION := 3.1.10
LIBVERSION := 3.1.10
2002-10-11 02:25:36 +05:30
############ vars
# so you can disable them or choose alternates
ldconfig := ldconfig
ln_f := ln -f
ln_sf := ln -sf
install := install -D --owner 0 --group 0
2002-10-11 02:25:36 +05:30
usr/bin := $(DESTDIR)/usr/bin/
bin := $(DESTDIR)/bin/
sbin := $(DESTDIR)/sbin/
usr/proc/bin := $(DESTDIR)/usr/bin/
man1 := $(DESTDIR)/usr/share/man/man1/
man5 := $(DESTDIR)/usr/share/man/man5/
man8 := $(DESTDIR)/usr/share/man/man8/
etc/X11/applnk/Utilities := $(DESTDIR)/etc/X11/applnk/Utilities/
usr/X11R6/bin := $(DESTDIR)/usr/X11R6/bin/
lib := $(DESTDIR)/lib/
usr/lib := $(DESTDIR)/usr/lib/
usr/include := $(DESTDIR)/usr/include/
2002-10-14 03:16:46 +05:30
#SKIP := $(bin)kill $(man1)kill.1
2002-10-11 02:25:36 +05:30
BINFILES := $(usr/bin)uptime $(usr/bin)tload $(usr/bin)free $(usr/bin)w \
$(usr/bin)top $(usr/bin)vmstat $(usr/bin)watch $(usr/bin)skill \
2002-10-27 16:05:13 +05:30
$(usr/bin)snice $(bin)kill $(sbin)sysctl $(usr/bin)pmap \
2002-10-11 02:25:36 +05:30
$(usr/proc/bin)pgrep $(usr/proc/bin)pkill
MANFILES := $(man1)uptime.1 $(man1)tload.1 $(man1)free.1 $(man1)w.1 \
$(man1)top.1 $(man1)watch.1 $(man1)skill.1 $(man1)kill.1 \
2002-10-27 16:05:13 +05:30
$(man1)snice.1 $(man1)pgrep.1 $(man1)pkill.1 $(man1)pmap.1 \
2002-10-11 02:25:36 +05:30
$(man5)sysctl.conf.5 $(man8)vmstat.8 $(man8)sysctl.8
2002-12-15 06:02:45 +05:30
TARFILES := AUTHORS BUGS NEWS README TODO COPYING COPYING.LIB \
2002-10-21 14:47:39 +05:30
Makefile procps.lsm procps.spec v t README.top \
2002-10-21 14:37:18 +05:30
minimal.c $(notdir $(MANFILES)) \
2002-10-11 04:10:35 +05:30
uptime.c tload.c free.c w.c top.c vmstat.c watch.c skill.c \
2003-06-03 05:01:12 +05:30
sysctl.c pgrep.c top.h pmap.c vmstat.h
2002-10-11 04:10:35 +05:30
2002-10-11 02:25:36 +05:30
CURSES := -I/usr/include/ncurses -lncurses
LDFLAGS := -Wl,-warn-common
CFLAGS := -D_GNU_SOURCE -O2 -g3 -fno-common -ffast-math -I proc \
2002-10-12 07:27:05 +05:30
-W -Wall -Wshadow -Wcast-align -Wredundant-decls \
2002-10-11 02:25:36 +05:30
-Wbad-function-cast -Wcast-qual -Wwrite-strings -Waggregate-return \
# -Wpadded -Wunreachable-code -Wdisabled-optimization \
2002-10-12 07:27:05 +05:30
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
2002-10-11 02:25:36 +05:30
############ misc.
# free.c pmap.c sysctl.c uptime.c vmstat.c watch.c pgrep.c skill.c tload.c top.c w.c
# utmp.c oldtop.c tmp-junk.c minimal.c
.SUFFIXES:
.SUFFIXES: .a .o .c .s .h
2002-10-11 04:10:35 +05:30
.PHONY: all clean do_all install tar # ps
2002-10-11 02:25:36 +05:30
ALL := $(notdir $(BINFILES))
CLEAN := $(notdir $(BINFILES))
DIRS :=
2002-10-21 14:37:18 +05:30
INSTALL := $(BINFILES) $(MANFILES)
2002-10-11 02:25:36 +05:30
# want this rule first, use := on ALL, and ALL not filled in yet
all: do_all
-include */module.mk
do_all: $(ALL)
junk := DEADJOE *~ *.o core gmon.out
# Remove $(junk) from all $(DIRS)
CLEAN += $(junk) $(foreach dir,$(DIRS),$(addprefix $(dir), $(junk)))
2002-10-14 03:16:46 +05:30
##########
# not maintained because it isn't really needed:
2002-10-11 02:25:36 +05:30
#
#SRC :=
#OBJ := $(patsubst %.c,%.o, $(filter %.c,$(SRC)))
#
#ifneq ($(MAKECMDGOALS),clean)
#-include $(OBJ:.o=.d)
#endif
#
#%.d: %.c
# depend.sh $(CFLAGS) $< > $@
2002-10-14 03:16:46 +05:30
############
2002-10-11 02:25:36 +05:30
2002-10-11 04:10:35 +05:30
# don't want to type "make procps-$(TARVERSION).tar.gz"
tar: $(TARFILES)
mkdir procps-$(TARVERSION)
(tar cf - $(TARFILES)) | (cd procps-$(TARVERSION) && tar xf -)
tar cf procps-$(TARVERSION).tar procps-$(TARVERSION)
gzip -9 procps-$(TARVERSION).tar
2002-10-11 02:25:36 +05:30
clean:
rm -f $(CLEAN)
###### install
2002-10-12 13:32:27 +05:30
$(BINFILES) : all
2002-10-11 04:10:35 +05:30
$(install) --mode a=rx --strip $(notdir $@) $@
2002-10-11 02:25:36 +05:30
2002-10-12 13:32:27 +05:30
$(MANFILES) : all
2002-10-11 04:10:35 +05:30
$(install) --mode a=r $(notdir $@) $@
2002-10-11 02:25:36 +05:30
2003-03-19 06:45:58 +05:30
install: $(filter-out $(SKIP) $(addprefix $(DESTDIR),$(SKIP)),$(INSTALL))
cd $(usr/bin) && $(ln_f) skill snice
cd $(usr/proc/bin) && $(ln_f) pgrep pkill
2002-10-11 02:25:36 +05:30
############ prog.c --> prog.o
%.o : %.c
$(CC) $(CFLAGS) -c -o $@ $^
w.o: w.c
$(CC) $(CFLAGS) $(W_SHOWFROM) -c $<
############ prog.o --> prog
2002-12-12 04:25:42 +05:30
pmap w uptime tload free sysctl vmstat utmp pgrep skill: % : %.o $(LIBPROC)
2002-10-11 02:25:36 +05:30
$(CC) $(LDFLAGS) -o $@ $^
top: % : %.o $(LIBPROC)
$(CC) $(LDFLAGS) -o $@ $^ $(CURSES)
watch: % : %.o
$(CC) $(LDFLAGS) -o $@ $^ $(CURSES)
############ progX --> progY
snice kill: skill
2002-10-12 09:55:57 +05:30
ln -f skill $@
2002-10-11 02:25:36 +05:30
pkill: pgrep
2002-10-12 09:55:57 +05:30
ln -f pgrep pkill