From 74b65e14f928e360de06e04d5e053fffbb522be4 Mon Sep 17 00:00:00 2001 From: Daniel Richard G Date: Tue, 27 Aug 2013 16:44:48 -0400 Subject: [PATCH] Revised the MSVC Makefile and build * Generate icons.h and icons-proto.h in the source directory instead of obj/, so that pre-generated copies of these files can be distributed without being blown away by "make clean"; also updated the source files that #include these to reflect the new location * Compilation rules rewritten as batch-mode inference rules * Use Windows commands instead of Unix ones ("del" instead of "rm", "move" instead of "mv", etc.) * Sorted the object lists * Use tabs to indent rule bodies --- Makefile | 129 +++++++++++++++++++++++++++------------------------- textwin.cpp | 3 +- toolbar.cpp | 2 +- 3 files changed, 70 insertions(+), 64 deletions(-) diff --git a/Makefile b/Makefile index 8186542..ae16195 100644 --- a/Makefile +++ b/Makefile @@ -1,98 +1,105 @@ +# SolveSpace may be built using Microsoft Visual Studio 2003 or newer. +# (MSVC++ 6.0 is not supported.) + DEFINES = /D_WIN32_WINNT=0x500 /DISOLATION_AWARE_ENABLED /D_WIN32_IE=0x500 /DWIN32_LEAN_AND_MEAN /DWIN32 # Use the multi-threaded static libc because libpng and zlib do; not sure if anything bad # happens if those mix, but don't want to risk it. -CFLAGS = /W3 /nologo -MT -Iextlib /D_DEBUG /D_CRT_SECURE_NO_WARNINGS /I. /Zi /EHs # /O2 +CXXFLAGS = /W3 /nologo /MT /D_DEBUG /D_CRT_SECURE_NO_DEPRECATE /D_CRT_SECURE_NO_WARNINGS /I. /Iextlib /Zi /EHs # /O2 HEADERS = win32\freeze.h ui.h solvespace.h dsc.h sketch.h expr.h polygon.h srf\surface.h OBJDIR = obj -W32OBJS = $(OBJDIR)\w32main.obj \ - $(OBJDIR)\w32util.obj \ - $(OBJDIR)\freeze.obj \ +W32OBJS = $(OBJDIR)\freeze.obj \ + $(OBJDIR)\w32main.obj \ + $(OBJDIR)\w32util.obj -SSOBJS = $(OBJDIR)\solvespace.obj \ - $(OBJDIR)\textwin.obj \ - $(OBJDIR)\textscreens.obj \ - $(OBJDIR)\confscreen.obj \ - $(OBJDIR)\describescreen.obj \ - $(OBJDIR)\graphicswin.obj \ - $(OBJDIR)\modify.obj \ +SSOBJS = \ + $(OBJDIR)\bsp.obj \ $(OBJDIR)\clipboard.obj \ - $(OBJDIR)\view.obj \ - $(OBJDIR)\util.obj \ - $(OBJDIR)\style.obj \ - $(OBJDIR)\entity.obj \ - $(OBJDIR)\drawentity.obj \ - $(OBJDIR)\group.obj \ - $(OBJDIR)\groupmesh.obj \ - $(OBJDIR)\request.obj \ - $(OBJDIR)\glhelper.obj \ - $(OBJDIR)\expr.obj \ + $(OBJDIR)\confscreen.obj \ $(OBJDIR)\constraint.obj \ $(OBJDIR)\constrainteq.obj \ - $(OBJDIR)\mouse.obj \ + $(OBJDIR)\describescreen.obj \ $(OBJDIR)\draw.obj \ - $(OBJDIR)\toolbar.obj \ $(OBJDIR)\drawconstraint.obj \ - $(OBJDIR)\file.obj \ - $(OBJDIR)\undoredo.obj \ - $(OBJDIR)\system.obj \ - $(OBJDIR)\polygon.obj \ - $(OBJDIR)\mesh.obj \ - $(OBJDIR)\bsp.obj \ - $(OBJDIR)\ttf.obj \ - $(OBJDIR)\generate.obj \ + $(OBJDIR)\drawentity.obj \ + $(OBJDIR)\entity.obj \ $(OBJDIR)\export.obj \ - $(OBJDIR)\exportvector.obj \ $(OBJDIR)\exportstep.obj \ + $(OBJDIR)\exportvector.obj \ + $(OBJDIR)\expr.obj \ + $(OBJDIR)\file.obj \ + $(OBJDIR)\generate.obj \ + $(OBJDIR)\glhelper.obj \ + $(OBJDIR)\graphicswin.obj \ + $(OBJDIR)\group.obj \ + $(OBJDIR)\groupmesh.obj \ + $(OBJDIR)\mesh.obj \ + $(OBJDIR)\modify.obj \ + $(OBJDIR)\mouse.obj \ + $(OBJDIR)\polygon.obj \ + $(OBJDIR)\request.obj \ + $(OBJDIR)\solvespace.obj \ + $(OBJDIR)\style.obj \ + $(OBJDIR)\system.obj \ + $(OBJDIR)\textscreens.obj \ + $(OBJDIR)\textwin.obj \ + $(OBJDIR)\toolbar.obj \ + $(OBJDIR)\ttf.obj \ + $(OBJDIR)\undoredo.obj \ + $(OBJDIR)\util.obj \ + $(OBJDIR)\view.obj -SRFOBJS = $(OBJDIR)\ratpoly.obj \ +SRFOBJS = $(OBJDIR)\boolean.obj \ $(OBJDIR)\curve.obj \ - $(OBJDIR)\surface.obj \ - $(OBJDIR)\triangulate.obj \ - $(OBJDIR)\boolean.obj \ - $(OBJDIR)\surfinter.obj \ - $(OBJDIR)\raycast.obj \ $(OBJDIR)\merge.obj \ - + $(OBJDIR)\ratpoly.obj \ + $(OBJDIR)\raycast.obj \ + $(OBJDIR)\surface.obj \ + $(OBJDIR)\surfinter.obj \ + $(OBJDIR)\triangulate.obj RES = $(OBJDIR)\resource.res - LIBS = user32.lib gdi32.lib comctl32.lib advapi32.lib shell32.lib opengl32.lib glu32.lib \ extlib\libpng.lib extlib\zlib.lib extlib\si\siapp.lib -all: $(OBJDIR)/solvespace.exe - @cp $(OBJDIR)/solvespace.exe . +PERL = perl + +all: $(OBJDIR)\solvespace.exe + @copy /y $(OBJDIR)\solvespace.exe . + @echo solvespace.exe clean: - rm -f obj/* + del /q obj\* -$(OBJDIR)/solvespace.exe: $(SRFOBJS) $(SSOBJS) $(W32OBJS) $(FREEZE) $(RES) - @$(CC) $(DEFINES) $(CFLAGS) -Fe$(OBJDIR)/solvespace.exe $(SSOBJS) $(SRFOBJS) $(W32OBJS) $(FREEZE) $(RES) $(LIBS) - editbin /nologo /STACK:8388608 $(OBJDIR)/solvespace.exe - @echo solvespace.exe +$(OBJDIR)\solvespace.exe: $(SSOBJS) $(SRFOBJS) $(W32OBJS) $(RES) + $(CXX) $(DEFINES) $(CXXFLAGS) /Fe$(OBJDIR)\solvespace.exe $(SSOBJS) $(SRFOBJS) $(W32OBJS) $(RES) $(LIBS) + editbin /nologo /STACK:8388608 $(OBJDIR)\solvespace.exe -$(SSOBJS): $(@B).cpp $(HEADERS) - @$(CC) $(CFLAGS) $(DEFINES) -c -Fo$(OBJDIR)/$(@B).obj $(@B).cpp +{.}.cpp{$(OBJDIR)}.obj:: + $(CXX) $(CXXFLAGS) $(DEFINES) /c /Fo$(OBJDIR)\ $< -$(SRFOBJS): srf\$(@B).cpp $(HEADERS) - @$(CC) $(CFLAGS) $(DEFINES) -c -Fo$(OBJDIR)/$(@B).obj srf\$(@B).cpp +{srf}.cpp{$(OBJDIR)}.obj:: + $(CXX) $(CXXFLAGS) $(DEFINES) /c /Fo$(OBJDIR)\ $< -$(W32OBJS): win32/$(@B).cpp $(HEADERS) - @$(CC) $(CFLAGS) $(DEFINES) -c -Fo$(OBJDIR)/$(@B).obj win32/$(@B).cpp +{win32}.cpp{$(OBJDIR)}.obj:: + $(CXX) $(CXXFLAGS) $(DEFINES) /c /Fo$(OBJDIR)\ $< -$(RES): win32/$(@B).rc icon.ico - rc win32/$(@B).rc - mv win32/$(@B).res $(OBJDIR)/$(@B).res +$(RES): win32\$(@B).rc icon.ico + $(RC) /fo$@ win32\$(@B).rc -toolbar.cpp: $(OBJDIR)/icons.h +$(OBJDIR)\glhelper.obj: bitmapextra.table bitmapfont.table font.table -textwin.cpp: $(OBJDIR)/icons.h +$(OBJDIR)\textwin.obj: icons.h -glhelper.cpp: bitmapfont.table font.table bitmapextra.table +$(OBJDIR)\toolbar.obj: icons.h -$(OBJDIR)/icons.h: icons/* png2c.pl - perl png2c.pl $(OBJDIR)/icons.h $(OBJDIR)/icons-proto.h +icons.h: icons\*.png png2c.pl + $(PERL) png2c.pl $@ icons-proto.h + +bitmapextra.table: icons\*.png pngchar2c.pl + $(PERL) pngchar2c.pl >tmp.$@ + move /y tmp.$@ $@ diff --git a/textwin.cpp b/textwin.cpp index 8174ec6..a632a6c 100644 --- a/textwin.cpp +++ b/textwin.cpp @@ -4,8 +4,7 @@ // Copyright 2008-2013 Jonathan Westhues. //----------------------------------------------------------------------------- #include "solvespace.h" -#include "obj/icons-proto.h" -#include +#include const TextWindow::Color TextWindow::fgColors[] = { { 'd', RGB(255, 255, 255) }, diff --git a/toolbar.cpp b/toolbar.cpp index f4b2983..bd9529a 100644 --- a/toolbar.cpp +++ b/toolbar.cpp @@ -6,7 +6,7 @@ // Copyright 2008-2013 Jonathan Westhues. //----------------------------------------------------------------------------- #include "solvespace.h" -#include "obj/icons.h" +#include BYTE SPACER[1]; static const struct {