# Makefile.in for yash: yet another shell
# (C) 2007-2020 magicant
#
# 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 <http://www.gnu.org/licenses/>.

.POSIX:
.SUFFIXES: .c .h .d .o .a

@MAKE_SHELL@
topdir = ..
subdir = builtins

CC = @CC@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LDLIBS = @LDLIBS@
AR = @AR@
ARFLAGS = @ARFLAGS@
SOURCES = printf.c test.c ulimit.c 
HEADERS = printf.h test.h ulimit.h
PRINTF_OBJS = printf.o
TEST_OBJS = test.o
ULIMIT_OBJS = ulimit.o
OBJS = @BUILTIN_OBJS@
TARGET = builtins.a
YASH = @TARGET@
BYPRODUCTS = *.dSYM

all: $(TARGET)

.c.o:
	@rm -f $@
	$(CC) $(CFLAGS) $(CPPFLAGS) -c $<

$(TARGET): $(OBJS)
	$(AR) $(ARFLAGS) $@ $(OBJS)

DISTFILES = $(SOURCES) $(SOURCES:.c=.d) $(HEADERS) Makefile.in
distfiles: makedeps $(DISTFILES)
copy-distfiles: distfiles
	mkdir -p $(topdir)/$(DISTTARGETDIR)
	cp $(DISTFILES) $(topdir)/$(DISTTARGETDIR)
makedeps: _PHONY
	@(cd $(topdir) && $(MAKE) $(YASH))
	CC='$(CC)' $(topdir)/$(YASH) $(topdir)/makedeps.yash $(SOURCES)

# ctags conforms to POSIX, but etags and cscope do not.
CTAGS = @CTAGS@
CTAGSARGS = @CTAGSARGS@
ETAGS = @ETAGS@
ETAGSARGS = @ETAGSARGS@
CSCOPE = @CSCOPE@
CSCOPEARGS = @CSCOPEARGS@
tags: $(SOURCES) $(HEADERS)
	$(CTAGS) $(CTAGSARGS)
TAGS: $(SOURCES) $(HEADERS)
	$(ETAGS) $(ETAGSARGS)
cscope: cscope.out
cscope.out: $(SOURCES) $(HEADERS)
	$(CSCOPE) $(CSCOPEARGS)

mostlyclean:
	-rm -rf $(OBJS) $(BYPRODUCTS)
clean: mostlyclean
	-rm -rf $(TARGET)
distclean: clean
	-rm -rf Makefile tags TAGS cscope.out
maintainer-clean: distclean
	-rm -rf $(SOURCES:.c=.d)

Makefile: Makefile.in $(topdir)/config.status
	@+(cd $(topdir) && $(MAKE) config.status)
	@(cd $(topdir) && $(SHELL) config.status $(subdir)/$@)

.PHONY: all distfiles copy-distfiles makedeps cscope mostlyclean clean distclean maintainer-clean
_PHONY:

@MAKE_INCLUDE@ printf.d
@MAKE_INCLUDE@ test.d
@MAKE_INCLUDE@ ulimit.d
