I am experiencing very strange behaviour of make in the mingw32 environment. My makefile works great on Linux, but behaves differently on mingw every time I use it and I can't figure out the pattern.
Make seems to be ignoring the target I give it to build. I try "make swi" and make tells me that "nothing needs to be done for all" and stops. I try "make clean", and instead make starts compiling things (it starts creating ".d" files - sometimes it creates just one or two ".d" files, sometimes all of them, but never does the actual target).
"make swi" and "make clean" should work because the makefile includes targets for "swi" and "clean" and the target "all" is deliberately empty to make there no default targets in the file. I also use a lot of conditions in the make file to add different flags for each target and operating system and I notice that make on mingw doesn't do them right. It's as if the target and the parameter $(MAKECMDGOALS) are blank.
What's going on here?
My makefile is attached here:
PRLG_INCLUDE = "C:\Program Files\pl\include"
PRLG_LIB = "C:\Program Files\pl\bin"
#PRLG_INCLUDE = /usr/local/lib/pl-5.0.10/include
#PRLG_LIB = /usr/local/lib/pl-5.0.10/runtime/i686-linux
TCL_INCLUDE = "C:\msys\local\include"
TCL_LIB = "C:\msys\local\lib"
SONAME = libtk4pl.so.0
SONAME2 = libtk4pl.so
CFLAGS = -shared -I$(PRLG_INCLUDE)
LFLAGS = -L$(PRLG_LIB) -Wl,-soname,$(SONAME)
RM = rm -f
SYS := $(shell gcc -dumpmachine)
OBJS = my_tcl.o terms.o tk4pl.o tk_Config.o tk_New.o
CFLAGS += -DSWI
LIBS += -lpl
OBJS += prlg-intf/tk4swi.o
CFLAGS += -DYAP
OBJS += prlg-intf/tk4yap.o
CFLAGS += -DXSB
OBJS += prlg-intf/tk4xsb.o
ifeq ($(SYS), mingw32)
CFLAGS += -I$(TCL_INCLUDE) -DWIN_MACHINE -DBUILDING_DLL=1
LFLAGS += -L$(TCL_LIB)
LIBS += -ltcl84 -ltk84
TGT = tk4pl.dll
LIBS += -ltcl8.4 -ltk8.4
TGT = libtk4pl.so.0.0.1
#calculate dependencies out of the objects
DEPS := $(patsubst %.o,%.d,$(OBJS))
swi yap xsb: $(OBJS) $(DEPS)
gcc -shared -o $(TGT) $(LFLAGS) $(LIBS) $(OBJS)
((`gcc -dumpmachine` != "mingw32")) || ln -s $(TGT) $(SONAME2)
gcc -c $(CFLAGS) $< -o $@
gcc -MM $(CFLAGS) $< > $@
gcc -MM $(CFLAGS) $< | sed s/\\.o/.d/ >> $@
$(RM) *.o *.d tk4pl.dll *.so* *~ prlg-intf/*.o prlg-intf/*.d prlg-intf/*~
b.t.w - I also had another problem. Make didn't find sed, which is used for the dependencies calculations. Although sed is installed with mingw in the /bin directory it wasn't recognized as an internal or exeternal command... I worked around that by copying sed.exe and msys-1.0.dll to the current directory. Is there another way to solve this?
Join Excite! - http://www.excite.com
The most personalized portal on the Web!