$(MAKE) install PREFIX=${stagedir}
        ${INSTALL} -m 644 ${FAKELIB} ${FAKETHRLIB} ${stagedir}/lib
 
+Event.cpp: EventAttrNames.pl
+
+JobStatus.cpp: StatusAttrNames.pl
+
+EventAttrNames.pl StatusAttrNames.pl:
+       ln -s ${stagedir}/share/${lbprefix}/at3/$@ $@
+
 dist: distsrc distbin
 
 distsrc:
        rm -rf *.o *.lo .libs lib* *.c *.cpp producer_test
        rm -rf ${LIB} ${THRLIB} ${TOOLS} logevent ${PLUSLIB} ${THRPLUSLIB} ${MAN_GZ} ${MAN8_GZ}
        rm -rf ${EXAMPLES} ${EXAMPLES_CL} ${EXAMPLES_CL_THR} ${sh_PROGS}
+       rm -f EventAttrNames.pl StatusAttrNames.pl
 
 
 check_version:
 
 #define CLASS_PREFIX "glite::lb::Event::"
 
 @@@{
+
+require 'EventAttrNames.pl';
+
 sub typeswitch {
        my $ftype = shift;
        my $resc = shift;
 
 
 static std::string const names[Event::TYPE_MAX] = {
-  "undefined",
+       "undefined",
 @@@{
   for (sort { $event->{order}->{$a} <=> $event->{order}->{$b} }
         $event->getTypes)
 }
 
 
-/* FIXME: this will not work with the current frozen assignment of constants in Event.h */
 static 
 std::string const attr_names[Event::ATTR_MAX] = {
 @@@{
-       for (sort {$a cmp $b} getAllFields $event) {
+#      for (sort {$a cmp $b} getAllFields $event) {
+#              gen "\t\"$_\",\n";
+#      }
+       for (@main::EventAttrNames) {
+               $_ = lc $_;
                gen "\t\"$_\",\n";
        }
 @@@}
 
 #define CLASS_PREFIX "glite::lb::JobStatus::"
 
 @@@{
+
+require 'StatusAttrNames.pl';
+
 sub typeswitch {
         my ($ftype,$ctype,$resc) = @_;
         local $_;
 }
 
 
-/* FIXME: this will not work with the current frozen assignment of constants in JobStatus.h */
 static std::string const attr_names[JobStatus::ATTR_MAX] = {
 @@@{
-       for (sort {$a cmp $b} getAllFields $status) {
+#      for (sort {$a cmp $b} getAllFields $status) {
+       for (@main::StatusAttrNames) {
+               $_ = lc $_;
                gen "\t\"$_\",\n";
        }
 @@@}