Makefile (3065B)
1 PACKAGE = rc 2 VERSION = 1.7.4 3 DESCRIPTION = $$(cd "$(srcdir)"; git describe --always) 4 5 srcdir = . 6 VPATH = $(srcdir) 7 8 PREFIX = /usr/local 9 MANPREFIX = $(PREFIX)/share/man 10 11 CC = cc 12 DEF_CFLAGS = -Wall 13 DEF_CPPFLAGS = -I$(PREFIX)/include 14 DEF_LDFLAGS = -L$(PREFIX)/lib 15 YACC = byacc 16 17 # line editing library: null/edit/editline/readline/vrl 18 EDIT = readline 19 20 # if your kernel supports `#!' magic numbers 21 HASH_BANG = 1 22 23 # if system calls automatically restart after interruption by signal 24 HAVE_RESTARTABLE_SYSCALLS = 0 25 26 # include extra builtins in addon.c 27 RC_ADDON = 0 28 29 # include parse tree dumper 30 RC_DEVELOP = 0 31 32 ALL_CFLAGS = $(DEF_CFLAGS) $(CFLAGS) 33 REQ_CPPFLAGS = -I. -I"$(srcdir)" \ 34 -DPACKAGE=\"$(PACKAGE)\" -DVERSION=\"$(VERSION)\" \ 35 -DDESCRIPTION=\"$(DESCRIPTION)\" -DHASH_BANG=$(HASH_BANG) \ 36 -DHAVE_RESTARTABLE_SYSCALLS=$(HAVE_RESTARTABLE_SYSCALLS) \ 37 -DRC_ADDON=$(RC_ADDON) -DRC_DEVELOP=$(RC_DEVELOP) 38 ALL_CPPFLAGS = $(REQ_CPPFLAGS) $(DEF_CPPFLAGS) $(CPPFLAGS) 39 ALL_LDFLAGS = $(DEF_LDFLAGS) $(LDFLAGS) 40 41 LIB_EDIT_null = 42 LIB_EDIT_edit = -ledit 43 LIB_EDIT_editline = -leditline 44 LIB_EDIT_readline = -lreadline 45 LIB_EDIT_vrl = -lvrl 46 LDLIBS = $(LIB_EDIT_$(EDIT)) 47 48 OBJ_ADDON_0 = 49 OBJ_ADDON_1 = addon.o 50 OBJ_DEVELOP_0 = 51 OBJ_DEVELOP_1 = develop.o 52 OBJ_EXECVE_0 = execve.o 53 OBJ_EXECVE_1 = 54 OBJ_SYSTEM_0 = system.o 55 OBJ_SYSTEM_1 = system-bsd.o 56 OBJS = $(OBJ_ADDON_$(RC_ADDON)) $(OBJ_DEVELOP_$(RC_DEVELOP)) builtins.o \ 57 edit-$(EDIT).o except.o exec.o $(OBJ_EXECVE_$(HASH_BANG)) fn.o footobar.o \ 58 getopt.o glob.o glom.o hash.o heredoc.o input.o lex.o list.o main.o match.o \ 59 nalloc.o open.o parse.o print.o redir.o sigmsgs.o signal.o status.o \ 60 $(OBJ_SYSTEM_$(HAVE_RESTARTABLE_SYSCALLS)) tree.o utils.o var.o wait.o \ 61 walk.o which.o 62 HDRS = addon.h develop.h edit.h getgroups.h input.h jbwrap.h proto.h rc.h \ 63 rlimit.h stat.h wait.h 64 BINS = history mksignal mkstatval tripping 65 66 all: rc 67 68 .PHONY: all check clean distclean install trip 69 .SUFFIXES: 70 .SUFFIXES: .c .o .y 71 $(V).SILENT: 72 73 rc: $(OBJS) 74 @echo "LINK $@" 75 $(CC) $(ALL_LDFLAGS) $(ALL_CFLAGS) -o $@ $(OBJS) $(LDLIBS) 76 77 $(OBJS): Makefile $(HDRS) config.h 78 79 .c.o: 80 @echo "CC $@" 81 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c -o $@ $< 82 83 config.h: 84 @echo "GEN $@" 85 cp "$(srcdir)/config.def.h" $@ 86 87 lex.o parse.o: parse.c 88 89 .y.c: 90 @echo "GEN $@" 91 $(YACC) -b $* -d $< 92 mv $*.tab.c $*.c 93 mv $*.tab.h $*.h 94 95 builtins.o fn.o hash.o sigmsgs.o signal.o status.o: sigmsgs.c 96 97 sigmsgs.c: mksignal 98 @echo "GEN $@" 99 ./mksignal 100 101 status.o: statval.h 102 103 statval.h: mkstatval 104 @echo "GEN $@" 105 ./mkstatval >$@ 106 107 $(BINS): Makefile rc.h proto.h config.h 108 109 .c: 110 @echo "CC $@" 111 $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -o $@ $< 112 113 check: trip 114 115 trip: rc tripping 116 ./rc -p <"$(srcdir)/trip.rc" 117 118 clean: 119 rm -f *.o $(BINS) rc 120 121 distclean: clean 122 rm -f config.h parse.[ch] sigmsgs.[ch] statval.h 123 124 install: all 125 @echo "INSTALL bin/rc" 126 mkdir -p $(DESTDIR)$(PREFIX)/bin 127 cp rc $(DESTDIR)$(PREFIX)/bin/ 128 chmod 755 $(DESTDIR)$(PREFIX)/bin/rc 129 @echo "INSTALL rc.1" 130 mkdir -p $(DESTDIR)$(MANPREFIX)/man1 131 cp rc.1 $(DESTDIR)$(MANPREFIX)/man1/ 132 chmod 644 $(DESTDIR)$(MANPREFIX)/man1/rc.1 133