- my $incs_on = "\@ !";
- my $incs_off = "\@ !";
- my $incs = "";
- my @incs = ();
- push @incs, @{$args{incs}} if @{$args{incs}};
- unless ($disabled{zlib}) {
- # GNV$ZLIB_INCLUDE is the standard logical name for later zlib
- # incarnations.
- push @incs, ($withargs{zlib_include} || 'GNV$ZLIB_INCLUDE:');
- }
- if (@incs) {
+ $cflags .= '$(CPPFLAGS)';
+ $cflags .= { lib => '$(LIB_CPPFLAGS)',
+ dso => '$(DSO_CPPFLAGS)',
+ bin => '$(BIN_CPPFLAGS)' } -> {$args{intent}};
+ my $defines = '$(DEFINES)';
+ $defines .= { lib => '$(LIB_DEFINES)',
+ dso => '$(DSO_DEFINES)',
+ bin => '$(BIN_DEFINES)' } -> {$args{intent}};
+ $cflags .= '/DEFINE=('.$defines.')';
+ $cflags .= "/INCLUDE=('tmp_includes')";
+
+ # We create a logical name TMP_INCLUDES: to hold the list of internal
+ # includes. However, we cannot use it directly, as logical names can't
+ # hold zero entries, so we also create a symbol with the same name and
+ # use that instead, see the '/INCLUDE=' assignment above. If there are
+ # no internal include directories, it will simply be the empty string,
+ # but if there are, it will be assigned "TMP_DEFINES:,"
+ my $xtraincludes = { lib => '$(LIB_INCLUDES)',
+ dso => '$(DSO_INCLUDES)',
+ bin => '$(BIN_INCLUDES)' } -> {$args{intent}};
+ my $incs_add =
+ 'IF tmp_add .NES. "" .AND. tmp_includes .NES. "" THEN tmp_includes = "," + tmp_includes'
+ ."\n\t".'tmp_includes = tmp_add + tmp_includes';
+ my $incs_on = 'tmp_includes := '
+ ."\n\t"."tmp_add := $xtraincludes"
+ ."\n\t".$incs_add
+ ."\n\t".'tmp_add := $(INCLUDES)'
+ ."\n\t".$incs_add;
+ my $incs_off = 'DELETE/SYMBOL/LOCAL tmp_includes'
+ ."\n\t".'DELETE/SYMBOL/LOCAL tmp_add';
+ if (@{$args{incs}}) {