PACKAGE = preload-hacks
VERSION := $(shell ./auto-version)
+.SECONDEXPANSION: #sorry
+
###--------------------------------------------------------------------------
### Configuration.
## noip
HACKS += noip
-NOIP_SOURCES = noip.c
-DISTFILES += $(NOIP_SOURCES)
+noip_SOURCES = noip.c
## uopen
HACKS += uopen
-UOPEN_SOURCES = uopen.c
-DISTFILES += $(UOPEN_SOURCES)
+uopen_SOURCES = uopen.c
+
+## Sources.
+ALL_SOURCES = $(foreach h,$(HACKS),$($h_SOURCES))
+DISTFILES += $(ALL_SOURCES)
## Libraries.
LIBS += $(addsuffix .so, $(HACKS))
debpkg = noip uopen
DISTFILES += debian/changelog debian/copyright
DISTFILES += debian/control debian/rules debian/compat
+DISTFILES += debian/source/format
DISTFILES += $(patsubst %, debian/%.install, $(debpkg))
DISTFILES += $(patsubst %, debian/%.lintian-overrides, \
$(debpkg))
###--------------------------------------------------------------------------
### Building.
-all: $(TARGETS)
+all:: $(TARGETS)
.PHONY: ALL
-clean:
- rm -f *.o $(TARGETS)
+CLEAN += $(TARGETS)
+CLEAN += *.o
+clean::
+ rm -f $(CLEAN)
.PHONY: clean
## Building sources.
$(V_CC) -c $(REAL_CFLAGS) $< -o $@
## Constructing preload hacks.
-noip.so: $(patsubst %.c, %.o, $(NOIP_SOURCES))
- $(V_LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
-uopen.so: $(patsubst %.c, %.o, $(UOPEN_SOURCES))
+$(addsuffix .so,$(HACKS)): %.so: $$(patsubst %.c,%.o,$$($$*_SOURCES))
$(V_LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
## Constructing the scripts.