64 lines
1.8 KiB
Makefile
64 lines
1.8 KiB
Makefile
.PHONY: clean install
|
|
|
|
CS_PATH=/usr
|
|
CFLAGS+=-I$(CS_PATH)/include/ClearSilver
|
|
CFLAGS+=$(shell Wand-config --cflags --cppflags)
|
|
LDFLAGS+=$(shell Wand-config --ldflags --libs)
|
|
|
|
CFLAGS+=$(shell pkg-config --cflags json)
|
|
LDFLAGS+=$(shell pkg-config --libs json)
|
|
OBJS=obj/main.o obj/util.o obj/galleries.o obj/gallery.o obj/varray.o \
|
|
obj/photo.o obj/hdf-json.o obj/jpeg.o \
|
|
$(CS_PATH)/lib/libneo_cgi.a $(CS_PATH)/lib/libneo_cs.a \
|
|
$(CS_PATH)/lib/libneo_utl.a
|
|
|
|
gallery.cgi: $(OBJS)
|
|
$(CC) -o $@ $(OBJS) $(LDFLAGS)
|
|
obj:
|
|
mkdir obj
|
|
|
|
obj/%.o: src/%.c include/%.h obj
|
|
$(CC) -DCOMPILESTAMP='"$(shell date "+%Y-%m-%d %H:%M:%S %z" )"' \
|
|
$(CFLAGS) -I include -o $@ -c $<
|
|
|
|
clean:
|
|
rm -fr obj gallery.cgi
|
|
|
|
install: gallery.cgi
|
|
ifeq ($(DESTDIR),)
|
|
@echo "Usage:"
|
|
@echo " $(MAKE) install DESTDIR=/path/to/htdocs/dir"
|
|
@echo "Optionally, you may specify the www group"
|
|
@echo "with WWWGID so permissions are set appropriately."
|
|
@exit 1
|
|
else
|
|
@if [ -f $(DESTDIR)/gallery.cgi ]; then \
|
|
mv $(DESTDIR)/gallery.cgi \
|
|
$(DESTDIR)/gallery.cgi.old; \
|
|
fi
|
|
@install -m 0755 gallery.cgi $(DESTDIR)
|
|
@if [ ! -d $(DESTDIR)/templates ] || [ "$(FORCE)" = "1" ]; then \
|
|
install -m 0755 -d $(DESTDIR)/templates/images; \
|
|
find templates -type f -exec \
|
|
install -m 0644 "{}" "$(DESTDIR)/{}" \; \
|
|
|| exit 1; \
|
|
else \
|
|
echo "Template directory already exists."; \
|
|
echo "I'll skip installing templates to prevent"; \
|
|
echo "existing ones being clobbered. Run:"; \
|
|
echo -n " $(MAKE) install DESTDIR=$(DESTDIR) "; \
|
|
echo "WWWGID=$(WWWGID) FORCE=1"; \
|
|
echo "to force installation."; \
|
|
fi; \
|
|
if [ "$(FORCE)" = "1" ]; then \
|
|
echo "Template installation forced. If your site breaks, you"; \
|
|
echo "get to keep the pieces. ;-)"; \
|
|
fi
|
|
ifeq ($(WWWGID),)
|
|
@install -m 0777 -d $(DESTDIR)/cache
|
|
else
|
|
@install -m 0775 -g $(WWWGID) -d $(DESTDIR)/cache
|
|
endif
|
|
|
|
endif
|