Re: [AD] Building Allegro for MSVC using the latest Cygwin is broken

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Peter Wang wrote:

Can't we just modify makefile.vc to call "$(MSVCDIR)/link" (or whatever), instead of "link"?


I have done just that. This solves the problem of calling the correct 'link' program when building Allegro for MSVC.

I have attatched a patch for makefile.vc that adds the absolute path to any MSVC utility that is used (except for rc, as that uses a different path).

As well as building for MSVC 6 using Cygwin, I've also successfully managed to get Allegro to build for MSVC 6 using DJGPP. Ideally before the patch is comitted, I'd like someone to test it by building Allegro for MSVC 6 using MinGW32, and also to test building Allegro for newer versions of MSVC (or any version of MSVC that uses spaces in the paths in the vcvars32.bat file, or uses an MSVCDIR variable with mixed-case).


AE.

PS. The patch also removes a trailing space from the line:
COMPILE_FLAGS = -DALLEGRO_STATICLINK
--- makefile.vc.old	2004-11-24 14:09:02.000000000 +0100
+++ makefile.vc	2005-03-17 02:15:16.022200000 +0100
@@ -120,6 +120,15 @@ endif
 
 
 
+# -------- Work out the absolute pathnames for some MSVC tools to avoid confusion --------
+
+MSVC_CL = $(MSVCDIR_U)/bin/cl
+MSVC_LINK = $(MSVCDIR_U)/bin/link
+MSVC_LIB = $(MSVCDIR_U)/bin/lib
+MSVC_RC = rc
+
+
+
 # -------- give a sensible default target for make without any args --------
 
 .PHONY: _default
@@ -282,17 +291,17 @@ ifdef STATICLINK
 # -------- link as a static library --------
 
 define MAKE_LIB
-   $(RUNNER) lib @ -nologo -out:$(LIB_NAME) $(OBJECTS)
+   $(RUNNER) $(MSVC_LIB) @ -nologo -out:$(LIB_NAME) $(OBJECTS)
 endef
 
-COMPILE_FLAGS = -DALLEGRO_STATICLINK 
+COMPILE_FLAGS = -DALLEGRO_STATICLINK
 
 else
 
 # -------- link as a DLL --------
 
 define MAKE_LIB
-   $(RUNNER) link @ -nologo $(LFLAGS) -dll -def:lib/msvc/allegro.def -out:$(DLL_NAME) -implib:$(IMPLIB_NAME) $(OBJECTS) $(LIBRARIES)
+   $(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -dll -def:lib/msvc/allegro.def -out:$(DLL_NAME) -implib:$(IMPLIB_NAME) $(OBJECTS) $(LIBRARIES)
 endef
 
 endif
@@ -300,34 +309,34 @@ endif
 COMPILE_FLAGS += $(subst src/,-DALLEGRO_SRC ,$(findstring src/, $<))$(CFLAGS)
 
 $(OBJ_DIR)/%.obj: %.c $(RUNNER)
-	$(RUNNER) cl @ -nologo $(COMPILE_FLAGS) -I. -I./include -Fo$@ -c $<
+	$(RUNNER) $(MSVC_CL) @ -nologo $(COMPILE_FLAGS) -I. -I./include -Fo$@ -c $<
 
 $(OBJ_DIR)/%.obj: %.cpp $(RUNNER)
-	$(RUNNER) cl @ -nologo $(COMPILE_FLAGS) -I. -I./include -Fo$@ -c $<
+	$(RUNNER) $(MSVC_CL) @ -nologo $(COMPILE_FLAGS) -I. -I./include -Fo$@ -c $<
 
 $(OBJ_DIR)/%.obj: %.s
 	$(GCC) $(SFLAGS) -I. -I./include -x assembler-with-cpp -o $@ -c $<
 
 $(OBJ_DIR)/%.obj: %.rc
-	rc -i"include" -fo$@ $<
+	$(MSVC_RC) -i"include" -fo$@ $<
 
 obj/msvc/%.res: %.rc
-	rc -fo$@ $<
+	$(MSVC_RC) -fo$@ $<
 
 tests/win/dibsound.exe: $(OBJ_DIR)/dibsound.obj obj/msvc/dibsound.res $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/dibsound.exe $(OBJ_DIR)/dibsound.obj obj/msvc/dibsound.res $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/dibsound.exe $(OBJ_DIR)/dibsound.obj obj/msvc/dibsound.res $(IMPLIB_NAME) $(LIBRARIES)
 
 tests/win/dxwindow.exe: $(OBJ_DIR)/dxwindow.obj obj/msvc/dxwindow.res $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/dxwindow.exe $(OBJ_DIR)/dxwindow.obj obj/msvc/dxwindow.res $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/dxwindow.exe $(OBJ_DIR)/dxwindow.obj obj/msvc/dxwindow.res $(IMPLIB_NAME) $(LIBRARIES)
 
 tests/win/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
 
 tests/win/scrsave.scr: $(OBJ_DIR)/scrsave.obj obj/msvc/scrsave.res $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/scrsave.scr $(OBJ_DIR)/scrsave.obj obj/msvc/scrsave.res $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:tests/win/scrsave.scr $(OBJ_DIR)/scrsave.obj obj/msvc/scrsave.res $(IMPLIB_NAME) $(LIBRARIES)
 
 tools/win/%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
 
 obj/msvc/demo.res: demo/demo.dat tools/win/wfixicon.exe
 ifdef STATICLINK
@@ -347,28 +356,28 @@ else
 endif
 
 demo/demo.exe: $(OBJ_DIR)/demo.obj obj/msvc/demo.res $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:demo/demo.exe $(OBJ_DIR)/demo.obj obj/msvc/demo.res $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:demo/demo.exe $(OBJ_DIR)/demo.obj obj/msvc/demo.res $(IMPLIB_NAME) $(LIBRARIES)
 
 */%.exe: $(OBJ_DIR)/%.obj $(IMPLIB_NAME) $(RUNNER)
-	$(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
+	$(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
 
 LINK_CONSOLE_DEPS = $(IMPLIB_NAME) $(RUNNER)
 
 define LINK_CONSOLE
-   $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
+   $(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(IMPLIB_NAME) $(LIBRARIES)
 endef
 
 obj/msvc/asmdef.inc: obj/msvc/asmdef.exe
 	obj/msvc/asmdef.exe obj/msvc/asmdef.inc
 
 obj/msvc/asmdef.exe: src/i386/asmdef.c include/*.h include/allegro/*.h obj/msvc/asmcapa.h $(RUNNER)
-	$(RUNNER) cl @ -nologo $(WFLAGS) -I. -I./include -Foobj/msvc/asmdef.obj -Feobj/msvc/asmdef.exe src/i386/asmdef.c
+	$(RUNNER) $(MSVC_CL) @ -nologo $(WFLAGS) -I. -I./include -Foobj/msvc/asmdef.obj -Feobj/msvc/asmdef.exe src/i386/asmdef.c
 
 obj/msvc/runner.exe: src/misc/runner.c
 	$(GCC) -O -Wall -Werror $(GCCFLAGS) -o obj/msvc/runner.exe src/misc/runner.c
 
 define LINK_WITHOUT_LIB
-   $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:console -out:$@ $^
+   $(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:console -out:$@ $^
 endef
 
 PLUGIN_LIB = lib/msvc/$(VERY_SHORT_VERSION)dat.lib
@@ -387,15 +396,15 @@ else
 endif
 
 define MAKE_PLUGIN_LIB
-   $(RUNNER) lib @ -nologo -out:$(PLUGIN_LIB) $(PLUGIN_OBJS)
+   $(RUNNER) $(MSVC_LIB) @ -nologo -out:$(PLUGIN_LIB) $(PLUGIN_OBJS)
 endef
 
 define LINK_WITH_PLUGINS
-   $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES))
+   $(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:windows -out:$@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES))
 endef
 
 define LINK_CONSOLE_WITH_PLUGINS
-   $(RUNNER) link @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES))
+   $(RUNNER) $(MSVC_LINK) @ -nologo $(LFLAGS) -subsystem:console -out:$@ $< $(strip $(PLUGIN_LIB) $(addprefix @,$(PLUGIN_SCRIPTS)) $(IMPLIB_NAME) $(LIBRARIES))
 endef
 
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/