taking evil to the next level: config files, templates, and scripts

to automatically generate project (.dsp) and workspace (.dsw) files
from configuration scripts for the bits that have to be built
on windows.  you build by saying 'make winfiles' here in stand,
then check in (on UNIX).  The versions that windows sees have to have
CR-NL line termination, so for proper use with samba the generated
files contain CRs and must be checked in on UNIX (NOT from Windows
CVS).
This commit is contained in:
cgd 2000-01-12 02:33:54 +00:00
parent 237f63f2d2
commit ce9a9c483e
7 changed files with 474 additions and 0 deletions

View File

@ -0,0 +1,12 @@
# $NetBSD: Makefile,v 1.1 2000/01/12 02:33:56 cgd Exp $
#
# Makefile to generate windows VC++ project and workspace files from
# config files and templates
PROJECT_DIRS=libsa pbsdboot
winfiles:
for dir in $(PROJECT_DIRS); do \
$$dir/$$dir.config; \
done
sh dspgen/gen_workspace.sh hpcmips_stand.dsw $(PROJECT_DIRS)

View File

@ -0,0 +1,104 @@
# Microsoft Developer Studio Project File - Name="pbsdboot" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (WCE MIPS) Application" 0x0a01
CFG=pbsdboot - Win32 (WCE MIPS) Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "pbsdboot.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "pbsdboot.mak" CFG="pbsdboot - Win32 (WCE MIPS) Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "pbsdboot - Win32 (WCE MIPS) Release" (based on "Win32 (WCE MIPS) Application")
!MESSAGE "pbsdboot - Win32 (WCE MIPS) Debug" (based on "Win32 (WCE MIPS) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP WCE_Configuration "H/PC Ver. 2.00"
CPP=clmips.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "pbsdboot - Win32 (WCE MIPS) Release"
# PROP BASE Use_MFC 1
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "WMIPSRel"
# PROP BASE Intermediate_Dir "WMIPSRel"
# PROP BASE Target_Dir ""
# PROP Use_MFC 1
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "WMIPSRel"
# PROP Intermediate_Dir "WMIPSRel"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /Yu"stdafx.h" /QMRWCE /c
# ADD CPP /nologo /MT /W3 /O2 %%% INCDIRS %%% /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" %%% CPPDEFS %%% /QMRWCE /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
# ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "NDEBUG"
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o NUL /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /NOLOGO
# ADD BSC32 /NOLOGO
LINK32=link.exe
# ADD BASE LINK32 /nologo /entry:"wWinMainCRTStartup" /machine:MIPS /subsystem:$(CESubsystem)
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
# ADD LINK32 commctrl.lib coredll.lib winsock.lib %%% LIBRARIES %%% /nologo /incremental:no /machine:MIPS /subsystem:$(CESubsystem) %%% RELEASE_LIBPATH %%%
# SUBTRACT LINK32 /pdb:none /nodefaultlib
PFILE=pfile.exe
# ADD BASE PFILE COPY
# ADD PFILE COPY
!ELSEIF "$(CFG)" == "pbsdboot - Win32 (WCE MIPS) Debug"
# PROP BASE Use_MFC 1
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "WMIPSDbg"
# PROP BASE Intermediate_Dir "WMIPSDbg"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "WMIPSDbg"
# PROP Intermediate_Dir "WMIPSDbg"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /Yu"stdafx.h" /QMRWCE /c
# ADD CPP /nologo /MLd /W3 /Zi /Od %%% INCDIRS %%% /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" %%% CPPDEFS %%% /QMRWCE /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
# ADD RSC /l 0x411 /r /d "MIPS" /d "_MIPS_" /d UNDER_CE=$(CEVersion) /d _WIN32_WCE=$(CEVersion) /d "$(CEConfigName)" /d "UNICODE" /d "DEBUG"
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o NUL /win32
BSC32=bscmake.exe
# ADD BASE BSC32 /NOLOGO
# ADD BSC32 /NOLOGO
LINK32=link.exe
# ADD BASE LINK32 /nologo /entry:"wWinMainCRTStartup" /debug /machine:MIPS /subsystem:$(CESubsystem)
# SUBTRACT BASE LINK32 /pdb:none /nodefaultlib
# ADD LINK32 commctrl.lib coredll.lib winsock.lib %%% LIBRARIES %%% /nologo /incremental:no /debug /machine:MIPS /subsystem:$(CESubsystem) %%% DEBUG_LIBPATH %%%
# SUBTRACT LINK32 /verbose /profile /pdb:none /map /nodefaultlib
PFILE=pfile.exe
# ADD BASE PFILE COPY
# ADD PFILE COPY
!ENDIF
# Begin Target
# Name "%%% NAME %%% - Win32 (WCE MIPS) Release"
# Name "%%% NAME %%% - Win32 (WCE MIPS) Debug"
%%% SRCFILES %%%
# End Target
# End Project

View File

@ -0,0 +1,158 @@
# $NetBSD: do_subst.sh,v 1.1 2000/01/12 02:33:54 cgd Exp $
#
# Copyright (c) 1999, 2000 Christopher G. Demetriou. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Christopher G. Demetriou
# for the NetBSD Project.
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
if [ "X$1" = "X--show-libdeps" ]; then
if ! expr "X$TYPE" : 'Xconsole_program.*' > /dev/null 2>&1 &&
! expr "X$TYPE" : 'Xapplication.*' > /dev/null 2>&1; then
exit
fi
( for lib in $LIBDEP_LIST; do
echo $lib
done ) | sort
exit
fi
AWK=awk
if [ `uname` = SunOS ]; then
AWK=nawk
fi
STD_CPPDEF_LIST=''
STD_INCDIR_LIST=''
STD_LIBRARY_LIST=''
export NAME
export SRCFILE_LIST
export CPPDEF_LIST STD_CPPDEF_LIST
export INCDIR_LIST STD_INCDIR_LIST
export LIBDEP_LIST
export LIBRARY_LIST STD_LIBRARY_LIST
${AWK} '
BEGIN {
NAME=ENVIRON["NAME"]
SRCFILES=""
sz = split(ENVIRON["SRCFILE_LIST"], a);
for (i = 1; i <= sz; i++) {
if (SRCFILES != "") {
SRCFILES=SRCFILES "\n"
}
SRCFILES=SRCFILES "# Begin Source File\n"
SRCFILES=SRCFILES "\n"
SRCFILES=SRCFILES "SOURCE=.\\" a[i] "\n"
SRCFILES=SRCFILES "# End Source File"
}
CPPDEFS=""
sz = split(ENVIRON["STD_CPPDEF_LIST"], a);
for (i = 1; i <= sz; i++) {
if (CPPDEFS != "") {
CPPDEFS=CPPDEFS " "
}
CPPDEFS=CPPDEFS "/D \"" a[i] "\""
}
sz = split(ENVIRON["CPPDEF_LIST"], a);
for (i = 1; i <= sz; i++) {
if (CPPDEFS != "") {
CPPDEFS=CPPDEFS " "
}
CPPDEFS=CPPDEFS "/D \"" a[i] "\""
}
INCDIRS=""
sz = split(ENVIRON["STD_INCDIR_LIST"], a);
for (i = 1; i <= sz; i++) {
if (INCDIRS != "") {
INCDIRS=INCDIRS " "
}
INCDIRS=INCDIRS "/I \"" a[i] "\""
}
sz = split(ENVIRON["INCDIR_LIST"], a);
for (i = 1; i <= sz; i++) {
if (INCDIRS != "") {
INCDIRS=INCDIRS " "
}
INCDIRS=INCDIRS "/I \"" a[i] "\""
}
sz = split(ENVIRON["LIBDEP_LIST"], a);
for (i = 1; i <= sz; i++) {
if (INCDIRS != "") {
INCDIRS=INCDIRS " "
}
INCDIRS=INCDIRS "/I \"..\\" a[i] "\""
}
LIBRARIES=""
sz = split(ENVIRON["STD_LIBRARY_LIST"], a);
for (i = 1; i <= sz; i++) {
if (LIBRARIES != "") {
LIBRARIES=LIBRARIES " "
}
LIBRARIES=LIBRARIES a[i] ".lib"
}
sz = split(ENVIRON["LIBRARY_LIST"], a);
for (i = 1; i <= sz; i++) {
if (LIBRARIES != "") {
LIBRARIES=LIBRARIES " "
}
LIBRARIES=LIBRARIES a[i] ".lib"
}
sz = split(ENVIRON["LIBDEP_LIST"], a);
for (i = 1; i <= sz; i++) {
if (LIBRARIES != "") {
LIBRARIES=LIBRARIES " "
}
LIBRARIES=LIBRARIES a[i] ".lib"
}
sz = split(ENVIRON["LIBDEP_LIST"], a);
DEBUG_LIBPATH=""
RELEASE_LIBPATH=""
for (i = 1; i <= sz; i++) {
if (i > 1) {
DEBUG_LIBPATH=DEBUG_LIBPATH " "
RELEASE_LIBPATH=RELEASE_LIBPATH " "
}
DEBUG_LIBPATH=DEBUG_LIBPATH "/libpath:\"..\\" a[i] "\\WMIPSDbg\""
RELEASE_LIBPATH=RELEASE_LIBPATH "/libpath:\"..\\" a[i] "\\WMIPSRel\""
}
}
{
gsub("%%% NAME %%%", NAME)
gsub("%%% SRCFILES %%%", SRCFILES)
gsub("%%% CPPDEFS %%%", CPPDEFS)
gsub("%%% INCDIRS %%%", INCDIRS)
gsub("%%% LIBRARIES %%%", LIBRARIES)
gsub("%%% DEBUG_LIBPATH %%%", DEBUG_LIBPATH)
gsub("%%% RELEASE_LIBPATH %%%", RELEASE_LIBPATH)
print $0
}
' ../dspgen/${TYPE}.tmpl | awk ' { printf "%s\r\n", $0 }' > ${NAME}.dsp

View File

@ -0,0 +1,85 @@
# $NetBSD: gen_workspace.sh,v 1.1 2000/01/12 02:33:54 cgd Exp $
#
# Copyright (c) 1999, 2000 Christopher G. Demetriou. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. All advertising materials mentioning features or use of this software
# must display the following acknowledgement:
# This product includes software developed by Christopher G. Demetriou
# for the NetBSD Project.
# 4. The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
AWK=awk
if [ `uname` = SunOS ]; then
AWK=nawk
fi
WORKSPACE_FILE=$1
shift
SORTED_PROJECTS=`(for project in $*; do
echo $project
done) | sort`
(
cat << __EOF__
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
__EOF__
for project in $SORTED_PROJECTS; do
echo ""
echo "Project: \"$project\"=.\\$project\\$project.dsp - Package Owner=<4>"
echo ""
echo "Package=<5>"
echo "{{{"
echo "}}}"
echo ""
echo "Package=<4>"
echo "{{{"
for libdep in `sh $project/$project.config --show-libdeps`; do
echo " Begin Project Dependency"
echo " Project_Dep_Name $libdep"
echo " End Project Dependency"
done
echo "}}}"
echo ""
echo "###############################################################################"
done
cat << __EOF__
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
__EOF__
) | awk ' { printf "%s\r\n", $0 }' > ${WORKSPACE_FILE}

View File

@ -0,0 +1,83 @@
# Microsoft Developer Studio Project File - Name="%%% NAME %%%" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (WCE MIPS) Static Library" 0x0a04
CFG=%%% NAME %%% - Win32 (WCE MIPS) Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "%%% NAME %%%.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "%%% NAME %%%.mak" CFG="%%% NAME %%% - Win32 (WCE MIPS) Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "%%% NAME %%% - Win32 (WCE MIPS) Release" (based on "Win32 (WCE MIPS) Static Library")
!MESSAGE "%%% NAME %%% - Win32 (WCE MIPS) Debug" (based on "Win32 (WCE MIPS) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
# PROP WCE_Configuration "H/PC Ver. 2.00"
CPP=clmips.exe
!IF "$(CFG)" == "%%% NAME %%% - Win32 (WCE MIPS) Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "WMIPSRel"
# PROP BASE Intermediate_Dir "WMIPSRel"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "WMIPSRel"
# PROP Intermediate_Dir "WMIPSRel"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /ML /W3 /O2 /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /YX /QMRWCE /c
# ADD CPP /nologo /ML /W3 /O2 %%% INCDIRS %%% /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "NDEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" %%% CPPDEFS %%% /QMRWCE /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /NOLOGO
# ADD BSC32 /NOLOGO
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ELSEIF "$(CFG)" == "%%% NAME %%% - Win32 (WCE MIPS) Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "WMIPSDbg"
# PROP BASE Intermediate_Dir "WMIPSDbg"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "WMIPSDbg"
# PROP Intermediate_Dir "WMIPSDbg"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MLd /W3 /Zi /Od /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" /YX /QMRWCE /c
# ADD CPP /nologo /MLd /W3 /Zi /Od %%% INCDIRS %%% /D _WIN32_WCE=$(CEVersion) /D "$(CEConfigName)" /D "DEBUG" /D "MIPS" /D "_MIPS_" /D UNDER_CE=$(CEVersion) /D "UNICODE" %%% CPPDEFS %%% /QMRWCE /c
# SUBTRACT CPP /YX
BSC32=bscmake.exe
# ADD BASE BSC32 /NOLOGO
# ADD BSC32 /NOLOGO
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo
!ENDIF
# Begin Target
# Name "%%% NAME %%% - Win32 (WCE MIPS) Release"
# Name "%%% NAME %%% - Win32 (WCE MIPS) Debug"
%%% SRCFILES %%%
# End Target
# End Project

View File

@ -0,0 +1,16 @@
#!/bin/sh
# $NetBSD: libsa.config,v 1.1 2000/01/12 02:33:56 cgd Exp $
# config file/script to generate project file (.dsp) for libsa
TYPE=static_library_WCE_MIPS
NAME='libsa'
SRCFILE_LIST='alloc.c bcopy.c close.c devopen.c dkcksum.c lseek.c open.c printf.c read.c subr_prf.c twiddle.c ufs.c winblk.c winfs.c'
CPPDEF_LIST='_STANDALONE'
INCDIR_LIST='. ../include ../../../..'
LIBDEP_LIST=''
LIBRARY_LIST=''
cd `dirname $0`
. ../dspgen/do_subst.sh

View File

@ -0,0 +1,16 @@
#!/bin/sh
# $NetBSD: pbsdboot.config,v 1.1 2000/01/12 02:33:56 cgd Exp $
# config file/script to generate project file (.dsp) for pbsdboot
TYPE=application_WCE_MIPS
NAME='pbsdboot'
SRCFILE_LIST='disptest.c elf.c layout.c main.c mips.c pbsdboot.c res\pbsdboot.rc platid.c platid_mask.c preference.c print.c systeminfo.c tx39xx.c vmem.c vr41xx.c res\pbsd.bmp res\pbsd.ico'
CPPDEF_LIST='_STANDALONE'
INCDIR_LIST='. ../include ../../../..'
LIBDEP_LIST='libsa'
LIBRARY_LIST=''
cd `dirname $0`
. ../dspgen/do_subst.sh