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

CC      = gcc
CFLAGS  = $(RPM_OPT_FLAGS) -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.UTF-8 hr_HR.UTF-8 ru_RU.UTF-8 fr_FR.UTF-8

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 -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