summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2005-04-13 12:22:00 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2005-04-13 12:22:00 +0000
commit883232dfcb5d853740424db066b747245331fcf3 (patch)
tree9b95f2986aac0c06748239e522f3e9acb0ea8cf4
parentf1c63f0a444b4d866479a71ac8fe6b1101589128 (diff)
downloadMPC-883232dfcb5d853740424db066b747245331fcf3.tar.gz
ChangeLogTag: Wed Apr 13 07:18:59 2005 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog12
-rw-r--r--modules/TemplateParser.pm16
-rw-r--r--templates/nmake.mpd16
3 files changed, 29 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f798ded..cf27b000 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Wed Apr 13 07:18:59 2005 Chad Elliott <elliott_c@ociweb.com>
+
+ * modules/TemplateParser.pm:
+
+ Rewrote the tp_dirname() method to use the builtin rindex function
+ instead of character iteration.
+
+ * templates/nmake.mpd:
+
+ Simplified this template to use dirname() instead of multiple
+ contains().
+
Mon Apr 11 08:46:56 2005 Chad Elliott <elliott_c@ociweb.com>
* templates/nmake.mpd:
diff --git a/modules/TemplateParser.pm b/modules/TemplateParser.pm
index ae8e89a4..4b6f4fba 100644
--- a/modules/TemplateParser.pm
+++ b/modules/TemplateParser.pm
@@ -112,16 +112,16 @@ sub basename {
sub tp_dirname {
- my($self) = shift;
- my($file) = shift;
+ my($self) = shift;
+ my($file) = shift;
+ my($index) = rindex($file, ($self->{'cslashes'} ? '\\' : '/'));
- for(my $i = length($file) - 1; $i != 0; --$i) {
- my($ch) = substr($file, $i, 1);
- if ($ch eq '/' || ($self->{'cslashes'} && $ch eq '\\')) {
- return $self->{'prjc'}->validated_directory(substr($file, 0, $i));
- }
+ if ($index >= 0) {
+ return $self->{'prjc'}->validated_directory(substr($file, 0, $index));
+ }
+ else {
+ return '.';
}
- return '.';
}
diff --git a/templates/nmake.mpd b/templates/nmake.mpd
index 9a15f8d0..1db1ca76 100644
--- a/templates/nmake.mpd
+++ b/templates/nmake.mpd
@@ -131,7 +131,7 @@ CPP_PROJ=/nologo <%if(add_compile)%><%add_compile%> <%endif%><%if(optimize)%><%o
<%if(!type_is_static)%>
RSC=rc.exe
<%foreach(resource_files)%>
-RSC_PROJ=/l 0x409 /fo"$(INTDIR)\<%if(contains(resource_file, ..\\) || starts_with(resource_file, \$))%><%basenoextension(resource_file)%><%else%><%noextension(resource_file)%><%endif%>.res"<%foreach(defines cpu_defines macros)%> /d <%define%><%endfor%><%if(unicode)%> /d UNICODE /d _UNICODE<%endif%><%foreach(includes)%> /i "<%include%>"<%endfor%>
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\<%if(dirname(resource_file))%><%noextension(resource_file)%><%else%><%basenoextension(resource_file)%><%endif%>.res"<%foreach(defines cpu_defines macros)%> /d <%define%><%endfor%><%if(unicode)%> /d UNICODE /d _UNICODE<%endif%><%foreach(includes)%> /i "<%include%>"<%endfor%>
<%endfor%>
<%endif%>
@@ -147,14 +147,14 @@ LINK32_FLAGS=/nologo /machine:<%machine("I386")%><%if(link_options)%> <%link_opt
LINK32_OBJS= \
<%if(!type_is_static)%>
<%foreach(resource_files)%>
- "$(INTDIR)\<%if(contains(resource_file, ..\\) || starts_with(resource_file, \$))%><%basenoextension(resource_file)%><%else%><%noextension(resource_file)%><%endif%>.res" \
+ "$(INTDIR)\<%if(dirname(resource_file))%><%noextension(resource_file)%><%else%><%basenoextension(resource_file)%><%endif%>.res" \
<%endfor%>
<%endif%>
<%if(pch_source)%>
- "$(INTDIR)\<%if(contains(pch_source, ..\\) || starts_with(pch_source, \$))%><%basenoextension(pch_source)%><%else%><%noextension(pch_source)%><%endif%>.obj" \
+ "$(INTDIR)\<%if(dirname(pch_source))%><%noextension(pch_source)%><%else%><%basenoextension(pch_source)%><%endif%>.obj" \
<%endif%>
<%foreach(source_files)%>
- "$(INTDIR)\<%if(contains(source_file, ..\\) || starts_with(source_file, \$))%><%basenoextension(source_file)%><%else%><%noextension(source_file)%><%endif%>.obj"<%fornotlast(" \\")%>
+ "$(INTDIR)\<%if(dirname(source_file))%><%noextension(source_file)%><%else%><%basenoextension(source_file)%><%endif%>.obj"<%fornotlast(" \\")%>
<%endfor%>
"<%if(type_is_dynamic)%><%if(dllout)%><%dllout%><%else%><%libout%><%endif%>\<%if(sharedname)%><%sharedname%><%else%><%staticname%><%endif%><%if(use_lib_modifier)%><%lib_modifier%><%endif%><%dll_ext%><%endif%><%if(type_is_static)%>$(OUTDIR)\<%staticname%><%if(use_lib_modifier)%><%lib_modifier%><%endif%><%lib_ext%><%endif%><%if(exename)%>$(INSTALLDIR)\<%exename%><%if(use_exe_modifier)%><%lib_modifier%><%endif%><%exe_ext%><%endif%>" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
@@ -231,13 +231,14 @@ SOURCE=<%pch_source%>
CPP_SWITCHES=/nologo <%if(add_compile)%><%add_compile%> <%endif%><%if(optimize)%><%optimize_flags%><%else%><%debug_flags%><%endif%> <%compile_flags%><%if(pdbc)%> /Fd"<%if(type_is_static)%><%libout%>\<%staticname%><%if(use_lib_modifier)%><%lib_modifier%><%endif%>.pdb<%else%>$(INTDIR)/<%endif%>"<%endif%> <%foreach(includes)%>/I "<%include%>" <%endfor%><%foreach(defines cpu_defines common_defines macros)%>/D <%define%> <%endfor%><%if(unicode)%>/D UNICODE /D _UNICODE <%endif%><%if(type_is_dynamic)%><%foreach(dynamicflags)%>/D <%dynamicflag%> <%endfor%><%endif%><%if(need_staticflags)%><%foreach(staticflags)%>/D <%staticflag%> <%endfor%><%endif%><%if(pch_header)%><%foreach(pch_defines)%>/D <%pch_define%> <%endfor%>/Fp"$(INTDIR)\<%noextension(pch_header)%>.pch" /Yc"<%pch_header%>" <%endif%>/FD /c
-"$(INTDIR)\<%if(contains(pch_source, ..\\) || starts_with(pch_source, \$))%><%basenoextension(pch_source)%><%else%><%noextension(pch_source)%><%endif%>.obj" "$(INTDIR)\<%noextension(pch_header)%>.pch" : "$(SOURCE)" "$(INTDIR)"
<%if(dirname(pch_source))%>
+"$(INTDIR)\<%noextension(pch_source)%>.obj" "$(INTDIR)\<%noextension(pch_header)%>.pch" : "$(SOURCE)" "$(INTDIR)"
@if not exist "$(INTDIR)\<%dirname(pch_source)%>\$(NULL)" mkdir "$(INTDIR)\<%dirname(pch_source)%>"
$(CPP) @<<
$(CPP_SWITCHES) /Fo"$(INTDIR)\<%noextension(pch_source)%>.obj" "$(SOURCE)"
<<
<%else%>
+"$(INTDIR)\<%basenoextension(pch_source)%>.obj" "$(INTDIR)\<%basenoextension(pch_header)%>.pch" : "$(SOURCE)" "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) /Fo"<%fo_flag%>" "$(SOURCE)"
<<
@@ -263,7 +264,8 @@ SOURCE=<%source_file%>
<%endfor%>
!ENDIF
<%else%>
-"$(INTDIR)\<%if(contains(source_file, ..\\) || starts_with(source_file, \$))%><%basenoextension(source_file)%><%else%><%noextension(source_file)%><%endif%>.obj" : "$(SOURCE)" "$(INTDIR)"
+"$(INTDIR)\<%basenoextension(source_file)%>.obj" : "$(SOURCE)" "$(INTDIR)"
+ $(CPP) $(CPP_PROJ) $(SOURCE)
<%endif%>
<%endfor%>
@@ -320,7 +322,7 @@ InputPath=<%custom_type->input_file%>
<%foreach(resource_files)%>
SOURCE=<%resource_file%>
-"$(INTDIR)\<%if(contains(resource_file, ..\\) || starts_with(resource_file, \$))%><%basenoextension(resource_file)%><%else%><%noextension(resource_file)%><%endif%>.res" : "$(SOURCE)" "$(INTDIR)"
+"$(INTDIR)\<%if(dirname(resource_file))%><%noextension(resource_file)%><%else%><%basenoextension(resource_file)%><%endif%>.res" : "$(SOURCE)" "$(INTDIR)"
<%if(dirname(resource_file))%>
@if not exist "$(INTDIR)\<%dirname(resource_file)%>\$(NULL)" mkdir "$(INTDIR)\<%dirname(resource_file)%>"
<%endif%>