Mail Archives: cygwin/2001/02/05/17:31:35
Hello,
On the topic of libpng built with Cygwin tools, I have the following
question. It concerns the breakage of `make' when I try to use a
conditional switch to choose what kind of linking to do, when building the
application pngcrush (a problematical but important libpng-using
application that *does not* build OOB as a dynamically-linked exe with
libpng.dll). In particular I am hoping Chuck Wilson can help (and THANK
YOU so MUCH for your persistent efforts on such ports as libpng to
Cygwin, Chuck!) because Chuck seems to know his way around `make'
very well indeed.
----- pasted USENET message, watch for wrapping -------
Newsgroups: gnu.utils.help, gnu.gcc.help
Hello, hope someone can help:
I have the following Makefile (copied here in full because I have exhausted
every idea that has occurred to me about why this makefile fails the way it
does).
When this is run it fails immediately with a message:
------- console dump, watch for wrapping -------
make: *** No rule to make target `adler32.c', needed by `adler32.o'. Stop.
------- cut here -------------------------------
The MAKEFILE:
------- Makefile text, watch for wrapping ------
# Sample makefile for pngcrush using gcc and make.
# Glenn Randers-Pehrson
# Last modified: [in-progress] - soren andersen
#
# Invoke this makefile from a shell prompt in the usual way; for example:
#
# make -f makefile.gcc
# macros --------------------------------------------------------------------
VPATH =../libpng-1.0.8 /mingw/include . /usr/include
CC = gcc
LD = gcc
RM = rm -vf
CFLAGS = -I../libpng-1.0.8 -I. -ID:/mingw/include -O -Wall
# [note that -Wall is a gcc-specific compilation flag ("all warnings on")]
LDFLAGS =
O = .o
E = .exe
PNGCRUSH = pngcrush
LIBS = -lm
LIBPATH = ../libpng-1.0.8
ifeq (DLL,$(LINKTYPE))
OBJS = $(PNGCRUSH)$(O)
LIBS += -lpng.dll
# .c$(O): png.h pngconf.h zlib.h pngcrush.h cexcept.h
# $(CC) -c $(CFLAGS) $<
else
PNGCRUSH = pngcrush_static
OBJS = adler32$(O) crc32$(O) deflate$(O) gzio$(O) \
infblock$(O) infcodes$(O) inffast$(O) inflate$(O) inftrees$(O) \
infutil$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) pnggccrd$(O) \
pngwtran$(O) pngwutil$(O) trees$(O) zutil$(O)
vpath %.c ../libpng-1.0.8
$(OBJS): %.o: %.c
$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $<
LIBS += -lpng
endif
EXES = $(PNGCRUSH)$(E)
# dependencies --------------------------------------------------------------
all: $(EXES)
$(PNGCRUSH)$(E): $(OBJS) $(PNGCRUSH)$(O)
$(LD) $(LDFLAGS) -o $@ $(OBJS) -L$(LIBPATH) $(LIBS)
$(PNGCRUSH)$(O): pngcrush.c png.h pngconf.h zlib.h pngcrush.h cexcept.h
# maintenance ---------------------------------------------------------------
clean:
$(RM) $(EXES) $(OBJS)
# Useful for debugging the values of variables during a make. To use
# it just call: make DEBUGVARS="var1 var2". No targets will get
# executed
#
ifdef DEBUGVARS
eval=$(1)
$(warning Debugging value of variables:)
$(foreach var,$(DEBUGVARS),$(warning $(var) = "$(call eval,$$($(var)))"))
$(error End of debugging)
endif
------- cut here -------------------------------
My objective is to be able to build either a static-linked version of this exe
or a Win32-dynamic link lib (DLL) -linked version, from one Makefile. The
LINKTYPE env var is the switch for that -if defined and eq "DLL" is will tell
make to link to a dll interface lib, else it will build all the needed static
objects (if not found up-to-date) and link them in to the exe.
The code I have already worked for building the dynamically linked version,
and supposedly worked as it came in the standard distro, to build the static
executable. I *only* need help with the specified issue (rephrased below),
thanks.
Thanks for any help someone can give in explaining why the implicit rule that
make is suppose to use, that tells it that a dependency ".c" file is NOT a
*target* needing to be rebuilt, but the starting point for creating ".o"
files, is being "turned off" somehow when this Makefile is run.
regards,
Soren Andersen
-------- end USENET paste job -------------------------
--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple
- Raw text -