Blob Blame Raw
DESTDIR =
DATADIR = /usr/share
BINDIR  = /usr/bin
MANDIR  = /usr/share/man

CC      = gcc
CFLAGS  += -O2 -Wall -D_GNU_SOURCE -DTM_YEAR_BASE=1900

SRCS    = calendar.c io.c day.c pesach.c ostern.c paskha.c
OBJS    = $(SRCS:.c=.o)
INTER   = de_DE.ISO_8859-1 hr_HR.ISO_8859-2 ru_RU.KOI8-R fr_FR.ISO8859-1

all: calendar

calendar: $(OBJS)
	$(CC) $(CFLAGS) -o calendar $(OBJS) $(LDFLAGS)

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

install: calendar
	mkdir -p $(DESTDIR)$(DATADIR)/calendar
	cd calendars ; \
	for calendar in calendar.* ; do \
		install -m 0644 $$calendar $(DESTDIR)$(DATADIR)/calendar/$$calendar ; \
	done
	for lang in $(INTER) ; do \
		cd calendars/$$lang ; \
		mkdir -p $(DESTDIR)$(DATADIR)/calendar/$$lang ; \
		for calendar in calendar.* ; do \
			install -m 0644 $$calendar $(DESTDIR)$(DATADIR)/calendar/$$lang/$$calendar ; \
		done ; \
		cd ../../ ; \
	done
	mkdir -p $(DESTDIR)/$(BINDIR) ; \
	install -s -m 0755 calendar $(DESTDIR)/$(BINDIR)/calendar ; \
	mkdir -p $(DESTDIR)/$(MANDIR)/man1 ; \
	install -m 0644 calendar.1 $(DESTDIR)/$(MANDIR)/man1/calendar.1

clean:
	-rm -rf $(OBJS) calendar