diff --git a/Makefile b/Makefile index d87cfd6..d050ed9 100644 --- a/Makefile +++ b/Makefile @@ -29,16 +29,16 @@ SOURCES=hello.cpp PRODUCTS=hello.exe # Define configuration options -CONFIG= HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_clearenv \ - HAVE_libm \ - HAVE_liboony \ - HAVE_sbrk +CONFIG= \ + \ + \ + \ + \ + \ + clearenv \ + libm \ + liboony \ + sbrk # Define what to test TESTS=product count-characters diff --git a/README.md b/README.md index e947ea7..3fad488 100644 --- a/README.md +++ b/README.md @@ -254,16 +254,16 @@ header file. Here is an example from the sample `Makefile`: - CONFIG= HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_ \ - HAVE_clearenv \ - HAVE_libm \ - HAVE_liboony \ - HAVE_sbrk + CONFIG= \ + \ + \ + \ + \ + \ + clearenv \ + libm \ + liboony \ + sbrk Here is what the generated `config.h` might look like: diff --git a/rules.mk b/rules.mk index f5c493b..b4dd5dd 100644 --- a/rules.mk +++ b/rules.mk @@ -372,7 +372,7 @@ endif NORM_CONFIG=$(subst <,.lt.,$(subst >,.gt.,$(subst /,.sl.,$(CONFIG)))) ORIG_TARGET=$(subst .lt.,<,$(subst .gt.,>,$(subst .sl.,/,$*))) -config.h: $(NORM_CONFIG:%=$(OBJDIR)/%) +config.h: $(NORM_CONFIG:%=$(OBJDIR)/HAVE_%) $(PRINT_GENERATE) cat $^ > $@ # C standard headers, e.g. HAVE_ @@ -380,24 +380,28 @@ $(OBJDIR)/HAVE_.lt.%.h.gt.: $(OBJDIR)/CONFIG_HAVE_%.c $(PRINT_CONFIG) $(CC_CONFIG) $(OBJDIR)/CONFIG_HAVE_%.c: $(OBJDIR)/.mkdir $(PRINT_GENERATE) echo '#include' "<$(ORIG_TARGET).h>" > "$@"; echo 'int main() { return 0; }' >> "$@" +.PRECIOUS: $(OBJDIR)/CONFIG_HAVE_%.c # C++ Standard headers, e.g. HAVE_ $(OBJDIR)/HAVE_.lt.%.gt.: $(OBJDIR)/CONFIG_HAVE_%.cpp $(PRINT_CONFIG) $(CXX_CONFIG) $(OBJDIR)/CONFIG_HAVE_%.cpp: $(OBJDIR)/.mkdir $(PRINT_GENERATE) echo '#include' "<$(ORIG_TARGET)>" > "$@"; echo 'int main() { return 0; }' >> "$@" +.PRECIOUS: $(OBJDIR)/CONFIG_HAVE_%.cpp # Library $(OBJDIR)/HAVE_lib%: $(OBJDIR)/CONFIG_LIB%.c $(PRINT_LIBCONFIG) $(LIB_CONFIG) $(OBJDIR)/CONFIG_LIB%.c: $(OBJDIR)/.mkdir $(PRINT_GENERATE) echo 'int main() { return 0; }' > "$@" +.PRECIOUS: $(OBJDIR)/CONFIG_LIB%.c # Check if a function is present $(OBJDIR)/HAVE_%: $(OBJDIR)/CONFIG_CHECK_%.c $(PRINT_CONFIG) $(FN_CONFIG) $(OBJDIR)/CONFIG_CHECK_%.c: $(BUILD)config/check_%.c $(OBJDIR)/.mkdir $(PRINT_COPY) cp $< $@ +.PRECIOUS: $(OBJDIR)/CONFIG_CHECK_%.c #------------------------------------------------------------------------------