* Name the `..._SOURCES' variable literally after the hack, so that it
can be recovered mechanically.
* Accumulate all of the sources together, into an `ALL_SOURCES' and
dump that into `DISTFILES', rather than marking them separately for
distribution.
* Replace the separate linker rules with a single static-pattern rule.
This unfortunately needs `.SECONDEXPANSION' to work properly.
PACKAGE = preload-hacks
VERSION := $(shell ./auto-version)
PACKAGE = preload-hacks
VERSION := $(shell ./auto-version)
+.SECONDEXPANSION: #sorry
+
###--------------------------------------------------------------------------
### Configuration.
###--------------------------------------------------------------------------
### Configuration.
-NOIP_SOURCES = noip.c
-DISTFILES += $(NOIP_SOURCES)
-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))
## Libraries.
LIBS += $(addsuffix .so, $(HACKS))
$(V_CC) -c $(REAL_CFLAGS) $< -o $@
## Constructing preload hacks.
$(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.
$(V_LD) $(REAL_LDFLAGS) $< $(LDLIBS) -o $@
## Constructing the scripts.